Newsgroups: bit.listserv.ibm-main
Date:         Thu, 8 Oct 1992 12:36:00 EST
From:         "Peter D. Matthews Jr." <pdm1881@MVS.DRAPER.COM>
Subject: XXWSC ISPF Edit Macro: Old Waterloo SYSPUB to GML
Comments: To: seb@draper.com, ibm-main@ricevm1.rice.edu

>
>From:   IN%"IBM-MAIN@ricevm1.rice.edu"  "IBM Mainframe Discussion list"
> 7-OCT-1992 11:46:41.90
>To:     IN%"IBM-MAIN@ricevm1.rice.edu"  "Multiple recipients of list IBM-MAIN"
>CC:
>Subj:   uow script to dcf converter
>
>Date: 07 Oct 1992 11:42:13 -0400 (EDT)
>From: Bob Quigley <BOB@ysu.edu>
>Subject: uow script to dcf converter
>
>I am looking for some kind of program to read fairly simple Waterloo
>script programs and convert them to IBM's DCF script language. Does
>such a beast exist? VM environment is best for me, but MVS is OK too.
>
>Thanks,
>Bob Quigley (bob@ysu.edu)
>Youngstown State University

Following is from our MVS System News.  Below that is current XXWSC
Macro and some tutorial panels.  It sometimes dies in the middle, but if
you run it again, it continues churning away, so I never fixed it.
Sorry that it's not REXX.

  April 17, 1986
| July 11, 1986 (revised)
|
| WATERLOO SCRIPT NOW UNSUPPORTED - XXWSC CONVERTS WSCRIPT TO GML
|
    ...

  The new XXWSC macro may be used when editing a sequential data set or
  member to convert from Waterloo SCRIPT and SYSPUB markup to IBM DCF
  (SCRIPT/VS) and GML markup.  The entire member being edited will be
  processed.

  The conversion is by no means complete, but it does handle the major
  constructs used in Waterloo SCRIPT, such as .POINT, .CHAPTER and .US.
  Manual editing will be required to polish the results, but XXWSC does
  80-90% of the job.

    ...

  To convert a document, do the following:

    1. Make a backup copy of your data set.

    2. Edit (a member of) the data set using ISPF option 2.

    3. COMMAND ===> XXWSC

    4. Carefully examine the results before saving.  Make any
       manual changes which you can see.

    5. Repeat steps 2-4 until all members have been converted.

    6. Format the document ... and correct any errors detected - print
       the results first, if necessary.


    ...


  - DETAILS

  Help for macros such as XXWSC is provided inside ISPF.  Press the HELP
  key or enter HELP in the COMMAND field while editing.  Then select
  option M on the Edit Tutorial menu.  XXWSC is a "system-wide" macro -
  select 1 on the next menu, and then name XXWSC.  Since you may find
  this somewhat cumbersome to reach (unless you're on an exploring
  expedition), we provide the information here:


    Native Control Words converted -

       .FO      --> .FO                .IX      --> :IH# :I#
       .UD SET      (affects .US)      .HY      --> .DU
       .US      --> :HP1 :EHP1         .EF      --> removed

       Other native controls are not changed

    SYSPUB Macros Converted -

       .PARA    --> :P                 .XPL     --> :FIG FRAME=BOX
       .POINT   --> :OL :UL :LI        .FIGNUM  --> ID=
       .PART    --> :H0                .TABNUM  --> ID=
       .APPENDIX--> :APPENDIX :H1      .FIGBEGIN--> :FIG
       .CHAPTER --> :H1                .TABBEGIN--> :TAB
       .NEWCHAP --> :H1                .FIGURE  --> :FIGCAP
       .SECTION --> :H2                .TABLE   --> :TABCAP
       .SUBSECT --> :H3                .FIGEND  --> :EFIG
       .SUBSUB  --> :H4                .TABEND  --> :ETAB
|      .SUBSUB1 --> :H5                .BOXON   --> :FIG FRAME=BOX, .BX
|      .SUBSUB2 --> :H6                .BOXOFF  --> :EFIG, .BX
       .SUBSUB3 --> :H7                .EQBEGIN --> :FORM
       .SUBSUB4 --> :H8                .EQEND   --> :EFORM
       .QUOTE   --> :LQ                .INDEX   --> :INDEX
       .FOOTNOTE--> :FN                .CONTENTS--> :TOC
       .ENDNOTE --> :FN                .FIGURES --> :FIGLIST
       .FOOTEND --> :EFN               .TABLES  --> :TABLIST
       .ENDEND  --> :EFN               Other controls are not changed


                    /* XXWSC:  WATERLOO SCRIPT SYSPUB ---> DCF GML */
                    /* VERSION 1.0   PETE MATTHEWS, 4-86           */
                    /* RENAMED FROM XXGML           2-87           */
  ISREDIT MACRO
  CONTROL NOFLUSH NOCAPS END(DEND)

  ISREDIT (L,L2) = NUMBER
  IF (&L = OFF)  THEN  GOTO INIT  /* SKIP UNNUMBERING */

  /* --------- CODE MODIFIED FROM XXUNNUM 4-4-86 ------------------- */
      ISREDIT (SAVELB,SAVERB) = BOUNDS
      ISREDIT UNNUM
      ISREDIT (RF) = RECFM
      IF &RF = V THEN DO
       ISREDIT (LR) = LRECL
       SET LASTCOL = &LR
       ISREDIT (LASTLINE) = LINENUM .ZLAST
       ISPEXEC CONTROL ERRORS RETURN
       ISREDIT BOUNDS = 1,&LASTCOL
       IF &LASTCC ^= 0 THEN DO
        ISPEXEC DISPLAY PANEL(ISRERROR)
        GOTO RECOVER
       DEND
       SET CURLINE = 0
       DO WHILE &CURLINE < &LASTLINE
        SET CURLINE = &CURLINE + 1
        ISREDIT SHIFT ( &CURLINE 8
        IF &LASTCC ^= 0 THEN DO
         ISPEXEC DISPLAY PANEL(ISRERROR)
         GOTO RECOVER
        DEND
       DEND
       RECOVER:+
       ISPEXEC CONTROL ERRORS CANCEL
       IF &SAVERB = &LASTCOL-8 THEN SET SAVERB = &LASTCOL
       ISREDIT BOUNDS = &SAVELB &SAVERB
      DEND
/* --------- END XXUNNUM ------------------------------- */

  ISPEXEC VGET (XXTRACE) SHARED
  IF &XXTRACE ^= THEN DO
    ISPEXEC CONTROL DISPLAY LINE
    CONTROL CONLIST SYMLIST LIST
    DEND

     /* INITIALIZE CONTROL VARIABLES */
  INIT: +
  ISREDIT SCAN = OFF                /* NO SUBSTITUTION FOR AMPERSANDS */
  ISREDIT (STATE) = USER_STATE      /* SAVE EDITING STATE */
  SET &AX     = FALSE
  SET &FG     = FALSE
  SET &XP     = FALSE
  SET &ID     = #NONE#
  SET &UDLM   = &STR(|)
  SET &LNEST  = 0
  SET &UNPROC = 0
  SET &FNNUM  = 0
  SET &P1     = O
  SET &P2     = O
  SET &P3     = O
  SET &P4     = O
  SET &AMP    = &&
  ISREDIT (MBR) = MEMBER
  IF &STR(&MBR) = &STR()  THEN  DO
    SET &FN1 = FN
    SET &FN2 =
    DEND
  ELSE  DO  /* SET FOOTNOTE ID'S, PLANNING FOR TWO DIGITS, 7 CHAR MAX */
    SET &FN1 = &SUBSTR(1:1,&MBR )
    SET &FN2 = &SUBSTR(2:3,&MBR  )+
               &SUBSTR(5:6,&MBR      )
    DEND

     /* COMMENT BEFORE FIRST CONTROL LINE */
  ISREDIT SEEK   '.'          FIRST 1 1
  SET &L = &NRSTR(.*    FROM WSCRIPT VIA XXWSC - &SYSUID &SYSDATE)
    ISREDIT  LINE_BEFORE .ZCSR = (L)

     /* SPLIT ALL MULTIPLE COMMAND LINES */
  ISREDIT CHANGE ';,'   ';.'  ALL
  ISREDIT SEEK   ';.'         FIRST
  SET &LCC = &LASTCC
  IF (&LCC=0)  THEN  DO
    ISREDIT TSPLIT
    ISREDIT CHANGE ';'   ''
    ISREDIT SEEK   ';.'
    DEND
     /* HANDLE WSCRIPT ABBERRATIONS */
  ISREDIT CHANGE '...'  '`~`' ALL 1 3 /* SAVE LABELS */
  ISREDIT CHANGE '..'   '.'   ALL 1 2
  ISREDIT CHANGE '`~`'  '...' ALL 1 3 /* RESTORE */
  ISREDIT CHANGE ',,'   '.'   ALL 1 2
  ISREDIT CHANGE ',.'   '.'   ALL 1 2
  ISREDIT CHANGE ','    '.'   ALL 1 1
  ISREDIT CHANGE '.SR'  '.SE' ALL 1 4
  ISREDIT CHANGE '.UR ' ''    ALL 1 4
  ISREDIT CHANGE '&NRSTR(&AMP.SYSPPAGE)'  '&NRSTR(&AMP.$PN)'  ALL
  ISREDIT CHANGE '&NRSTR(&AMP.SYSPAGE)'   '&NRSTR(&AMP.$PN)'  ALL

     /* MAIN PROCESSING LOOP */
  ISREDIT SEEK '.' 1 1 FIRST
  IF (&LASTCC>0)  THEN  DO  /* ALL DONE OR ERROR */
    ISPEXEC SETMSG MSG(XWSC001)
    SET &LCC = 0
    GOTO RETURN
    DEND
  GOTO PARSE  /* PROCESS INITIAL SEEK */

  NEXTCODE: +
    ISREDIT SEEK '.' 1 1
    IF (&LASTCC>0)  THEN  DO  /* ALL DONE OR ERROR */
      ISPEXEC SETMSG MSG(XWSC001)
      SET &LCC = 0
      GOTO RETURN
      DEND

       /* OBTAIN CURRENT LINE, CHECK CONTROL WORD */
    PARSE: +
    ISREDIT CHANGE ';' ' ' .ZCSR .ZCSR   /* STRIP FIRST SEMICOLON */
    IF &LASTCC = 0  THEN  ISREDIT TSPLIT
       /* OBTAIN CURRENT LINE, PARSE */
    ISREDIT (L) = LINE .ZCSR
    SET &SYSDVAL = &NRSTR(&L)
    READDVAL L1 L2 L3 L4 L5 L6

    IF (&SUBSTR(1:2,&L1  ) = &STR(.*))  THEN  GOTO NEXTCODE
    CONTROL CAPS  /* UPPERCASE FOR TESTING */
    SET &LS = &L1
    SET &L1 = &SUBSTR(2:8,&L1        )
    CONTROL NOCAPS
    ISREDIT (ROW,COL) = CURSOR

       /* SELECT CONTROL WORD */
    IF (&L1 = FO     )  THEN  GOTO FO
    IF (&L1 = UD     )  THEN  GOTO UD
    IF (&L1 = US     )  THEN  GOTO US
    IF (&L1 = IX     )  THEN  GOTO IX
    IF (&L1 = HY     )  THEN  GOTO DU
    IF (&L1 = EF     )  THEN  GOTO EF
    IF (&L1 = CC     )  THEN  GOTO CC
    IF (&L1 = CP     )  THEN  GOTO CC
    IF (&L1 = CE     )  THEN  GOTO CC /* BEGIN/END AS :XMP ! */
    IF (&L1 = PAGE   )  THEN  GOTO PAGE
    IF (&L1 = .EF    )  THEN  GOTO EF /* ODDITY ON LAST LINE */
    IF (&LENGTH(&L1) = 2)  THEN  GOTO NEXTCODE /* NATIVE CONTROL WORD */
    IF (&L1 = PARA   )  THEN  GOTO P
    IF (&L1 = POINT  )  THEN  GOTO LISTS
    IF (&L1 = PART   )  THEN  GOTO H0
    IF (&L1 = APPENDI)  THEN  GOTO APPX
    IF (&L1 = CHAPTER)  THEN  GOTO H1
    IF (&L1 = NEWCHAP)  THEN  GOTO H1
    IF (&L1 = NEWAPPX)  THEN  GOTO H1
    IF (&L1 = SECTION)  THEN  GOTO H2
    IF (&L1 = SUBSECT)  THEN  GOTO H3
    IF (&L1 = SUBSUB )  THEN  GOTO H4
    IF (&L1 = SUBSUB1)  THEN  GOTO H5
    IF (&L1 = SUBSUB2)  THEN  GOTO H6
    IF (&L1 = SUBSUB3)  THEN  GOTO H7
    IF (&L1 = SUBSUB4)  THEN  GOTO H8
    IF (&L1 = QUOTE  )  THEN  GOTO QUOTE
    IF (&L1 = FOOTNOT)  THEN  GOTO FN
    IF (&L1 = ENDNOTE)  THEN  GOTO FN
    IF (&L1 = FOOTEND)  THEN  GOTO EFN
    IF (&L1 = ENDEND )  THEN  GOTO EFN
    IF (&L1 = XPL    )  THEN  GOTO XPL
    IF (&L1 = FIGNUM )  THEN  GOTO FIGID
    IF (&L1 = TABNUM )  THEN  GOTO FIGID
    IF (&L1 = FIGBEGI)  THEN  GOTO FIG
    IF (&L1 = TABBEGI)  THEN  GOTO TAB
    IF (&L1 = FIGURE )  THEN  GOTO FIGCAP
    IF (&L1 = TABLE  )  THEN  GOTO TABCAP
    IF (&L1 = FIGEND )  THEN  GOTO EFIG
    IF (&L1 = TABEND )  THEN  GOTO ETAB
    IF (&L1 = BOXON  )  THEN  GOTO BOXON
    IF (&L1 = BOXOFF )  THEN  GOTO BOXOFF
    IF (&L1 = EQBEGIN)  THEN  GOTO FORM
    IF (&L1 = EQEND  )  THEN  GOTO EFORM
    IF (&L1 = INDEX  )  THEN  GOTO INDEX
    IF (&L1 = CONTENT)  THEN  GOTO TOC
    IF (&L1 = FIGURES)  THEN  GOTO FIGLIST
    IF (&L1 = TABLES )  THEN  GOTO TABLIST
    SET &UNPROC = &UNPROC + 1
    GOTO NEXTCODE /* NOT PROCESSED */

  FO: +
    CONTROL CAPS  /* UPPERCASE FOR TESTING */
    SET &L2 = &NRSTR(&L2)
    CONTROL NOCAPS
    IF (&L2 = ON) OR (&L2 = YES) OR (&L2 = BEGIN)  THEN  SET &L2 = ON
    IF (&L2 = OFF) OR (&L2 = NO) OR (&L2 = END)    THEN  SET &L2 = OFF
    SET &L = &NRSTR(.FO &L2)
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  US: +
    CONTROL CAPS  /* UPPERCASE FOR TESTING */
    SET &L2 = &NRSTR(&L2)
    CONTROL NOCAPS
    IF (&NRSTR(&L2) = ON) OR (&NRSTR(&L2) = YES) OR +
       (&NRSTR(&L2) = BEGIN) OR (&DATATYPE(&NRSTR(&L2)) = NUM)  THEN  DO
      /* ASSIGN LABEL .USON */  ISREDIT LABEL .ZCSR = .USON
      SET &USROW = &ROW
      SET &L = &NRSTR(.*    &L.)
      ISREDIT  LINE .ZCSR = (L)
      ISREDIT  LINE_AFTER .ZCSR = :HP1.
      IF (&DATATYPE(&L2) NE NUM)  THEN  GOTO NEXTCODE
        /* PROCESS .US NUMBER */
        SET &ROW = &ROW + &L2
        ISREDIT CURSOR = (ROW)
        ISREDIT LINE_AFTER .ZCSR = &STR(.* &L2)
        SET &ROW = &ROW + 1
        ISREDIT CURSOR = (ROW)
        /* NOW PROCESS END */ SET &L2 = OFF
      DEND
    IF (&STR(&L2) = OFF) OR (&STR(&L2) = NO) OR (&STR(&L2) = END)  +
        THEN  DO
      SET &L = &NRSTR(.*   .US &L2)
      ISREDIT  LINE .ZCSR = (L)
      DEND
    ELSE  DO   /* .US LINE  (NOTE: LINE CAN HAVE ONLY 1 LABEL) */
      SET &USROW = &ROW
      ISREDIT CHANGE '.US ' ':HP1.' .ZCSR .ZCSR
      SET &ROW = &ROW - 1
      ISREDIT CURSOR = (ROW)
      ISREDIT LABEL .ZCSR = .USON
      SET &ROW = &ROW + 1
      ISREDIT CURSOR = (ROW)
      DEND
    /* CHANGE UNDERSCORE DELIMITERS */
    ISREDIT LABEL .ZCSR = .USOFF
    /* SEARCH FROM TOP OF RANGE */ ISREDIT CURSOR = (USROW)
    CDLM: +
    SET USSTAT = ON
    ISREDIT CHANGE '&UDLM' ':EHP1.' .USON .USOFF
    IF &LASTCC = 0  THEN  DO
      SET USSTAT = OFF
      ISREDIT CHANGE '&UDLM' ':HP1.' .USON .USOFF
      IF &LASTCC = 0  THEN  GOTO CDLM
      DEND
    IF (&USSTAT = ON)  THEN  ISREDIT LINE_AFTER .USOFF = :EHP1.
    GOTO NEXTCODE

  UD: +
    SET &L = &NRSTR(.*   &L)
    ISREDIT  LINE .ZCSR = (L)
    IF &NRSTR(&L2) = SET  THEN  SET &UDLM = &NRSTR(&L3.)
    GOTO NEXTCODE

  IX: +
    IF &DATATYPE(&NRSTR(&L2)) = NUM  THEN DO  /* IGNORE INDEX # */
      SET &L2 = &NRSTR(&L3)
      SET &L3 = &NRSTR(&L4)
      SET &L4 = &NRSTR(&L5)
      DEND
    IF &NRSTR(&L4) NE &STR()  THEN  +
          SET &L = &NRSTR(:IH1.&L2.:IH2.&L3.:I3.&L4.)
    ELSE  IF &NRSTR(&L3) NE &STR()  THEN  +
          SET &L = &NRSTR(:IH1.&L2.:I2.&L3.)
    ELSE  SET &L = &NRSTR(:I1.&L2.)
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  DU: +
    SET &L = &NRSTR(.DU ADD &L3.)
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  EF: +
    SET &L = &NRSTR(.*    &L)
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  CC: +
    CONTROL CAPS  /* UPPERCASE FOR TESTING */
    SET &L2 = &NRSTR(&L2)
    CONTROL NOCAPS
    IF (&NRSTR(&L2) = ON) OR (&NRSTR(&L2) = YES) OR +
       (&NRSTR(&L2) = BEGIN)  THEN  DO
      IF (&XP = FALSE  AND  &FG = FALSE)  THEN  SET &L = &NRSTR(:XMP.)
      ELSE                                      SET &L = &NRSTR(.*   &L)
      ISREDIT  LINE .ZCSR = (L)
      SET &XP = TRUE
      DEND
    ELSE  IF (&STR(&L2) = OFF) OR (&STR(&L2) = NO) OR +
             (&STR(&L2) = END)  THEN  DO
      IF (&XP = TRUE)    THEN  SET &L = &NRSTR(:EXMP.)
      ELSE                     SET &L = &NRSTR(.*   &L)
      ISREDIT  LINE .ZCSR = (L)
      SET &XP = FALSE
      DEND
    ELSE  DO
      /* NOTHING - NUMBER ASSUMED, OK IN DCF */
      DEND
    GOTO NEXTCODE

  PAGE: +
    SET &L = &NRSTR(.PA)
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  P: +
    SET &L = :P.
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  LISTS: /* INCOMPLETE */ +
    CONTROL CAPS  /* UPPERCASE FOR TESTING */
    SET &L2 = &NRSTR(&L2)
    SET &L3 = &NRSTR(&L3)
    SET &L4 = &NRSTR(&L4)
    SET &L5 = &NRSTR(&L5)
    SET &L6 = &NRSTR(&L6)
    CONTROL NOCAPS

    IF &NRSTR(&L2) = SET  THEN  DO
      IF &NRSTR(&L3) = B  THEN  SET &P1 = U
      ELSE                      SET &P1 = O
      IF &NRSTR(&L4) = B  THEN  SET &P2 = U
      ELSE                      SET &P2 = O
      IF &NRSTR(&L5) = B  THEN  SET &P3 = U
      ELSE                      SET &P3 = O
      IF &NRSTR(&L6) = B  THEN  SET &P4 = U
      ELSE                      SET &P4 = O
      SET &L = &NRSTR(.*    &L)
      ISREDIT  LINE .ZCSR = (L)
      GOTO NEXTCODE
      DEND

    IF &NRSTR(&L2) = BEGIN  THEN  DO
      SET &L2 = 1
      SET &LNEST = 0
      DEND

    IF &NRSTR(&L2) = END    THEN  DO
      SET &L2 = 0
      SET &L = &NRSTR(.*    &L)
      ISREDIT  LINE .ZCSR = (L)
      DEND
    ELSE  DO
      SET &L = :LI.
      ISREDIT  LINE .ZCSR = (L)
      IF &NRSTR(&L2) = &STR()  THEN  GOTO NEXTCODE
      DEND

    IF &DATATYPE(&L2) = NUM  THEN  DO
      DO WHILE(&LNEST>&L2)  /* END TO CORRECT LEVEL */
        SET &PTYPE = &AMP.P&LNEST.
        SET &L = :E&PTYPE.L.
        ISREDIT  LINE_BEFORE .ZCSR = (L)
        SET &LNEST = &LNEST - 1
        DEND
      DO WHILE(&LNEST<&L2)  /* BEGIN TO CORRECT LEVEL */
        SET &LNEST = &LNEST + 1
        SET &PTYPE = &AMP.P&LNEST.
        SET &L = :&PTYPE.L.
        ISREDIT  LINE_BEFORE .ZCSR = (L)
        DEND
      GOTO NEXTCODE
      DEND

    GOTO NEXTCODE  /* END LISTS */


  H0: +
    SET &L1 = :H0.
    GOTO HEAD

  APPX: +
    IF &AX = FALSE  THEN  SET &AX = EXEC
  H1: +
    SET &L1 = :H1.
    GOTO HEAD

  H2: +
    SET &L1 = :H2.
    GOTO HEAD

  H3: +
    SET &L1 = :H3.
    GOTO HEAD

  H4: +
    SET &L1 = :H4.
    GOTO HEAD

  H5: +
    SET &L1 = :H5.
    GOTO HEAD

  H6: +
    SET &L1 = :H6.
    GOTO HEAD

  H7: +
    SET &L1 = :H7.
    GOTO HEAD

  H8: +
    SET &L1 = :H8.
    GOTO HEAD

  HEAD: +
    SET &L = &NRSTR(&L1.&L2)
    ISREDIT  LINE .ZCSR = (L)
    IF &AX = EXEC  THEN  DO
      ISREDIT LINE_BEFORE .ZCSR = :APPENDIX.
      SET &AX = TRUE
      DEND
    GOTO NEXTCODE

  QUOTE: +
    CONTROL CAPS  /* UPPERCASE FOR TESTING */
    SET &L2 = &NRSTR(&L2)
    CONTROL NOCAPS
    IF &L2 = BEGIN  THEN  SET &L = :LQ.
    ELSE                  SET &L = :ELQ.
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  FN: +
    SET &FNNUM = &FNNUM +1
    SET &L = &NRSTR(&L2.:FNREF REFID=&FN1.&FNNUM.&FN2..)
    ISREDIT  LINE .ZCSR = (L)
    SET &L = &NRSTR(:FN ID=&FN1.&FNNUM.&FN2..)
    ISREDIT  LINE_AFTER .ZCSR = (L)
    GOTO NEXTCODE

  EFN: +
    IF (&LS = .ENDNOTES)  THEN   SET &L = &NRSTR(.*    &L.)
    ELSE                         SET &L = :EFN.
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  XPL: /* .XPL WAS BOXED ONE-LINE FIGURE */+
    SET &L = &NRSTR(:FIG PLACE=INLINE FRAME=BOX.)
    ISREDIT  LINE .ZCSR = (L)
    SET &L = :EFIG.
    ISREDIT  LINE_AFTER .ZCSR = (L)
    SET &L = &NRSTR(&L2.)
    ISREDIT  LINE_AFTER .ZCSR = (L)
    GOTO NEXTCODE /* NOTE "REVERSED" ORDER OF MULTIPLE "AFTER" LINES */

  FIGID: GOTO TABID
  TABID: +
    SET &ID = &NRSTR(&L2)
    SET &L = &NRSTR(.*      &L)
    ISREDIT  LINE .ZCSR = (L)
    ISREDIT CHANGE 'FIGURE &NRSTR(&AMP.&ID.)' +
      ':FIGREF REFID=&ID. PAGE=NO'  ALL
    ISREDIT CHANGE 'TABLE &NRSTR(&AMP.&ID.)' +
      ':TABREF REFID=&ID. PAGE=NO'  ALL
    GOTO NEXTCODE

  FIG: +
    SET &L = &NRSTR(:FIG ID=&ID. PLACE=INLINE WIDTH=PAGE FRAME=NONE.)
    ISREDIT  LINE .ZCSR = (L)
    SET &FG = TRUE
    GOTO NEXTCODE

  TAB: +
    SET &L = &NRSTR(:TAB ID=&ID. PLACE=INLINE WIDTH=PAGE FRAME=NONE.)
    ISREDIT  LINE .ZCSR = (L)
    SET &FG = TRUE
    GOTO NEXTCODE

  FIGCAP: +
    SET &L = &NRSTR(:FIGCAP.&L3.)
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  TABCAP: +
    SET &L = &NRSTR(:TABCAP.&L3.)
    ISREDIT  LINE .ZCSR = (L)
    ISREDIT  LINE_AFTER .ZCSR = :TABBODY.
    GOTO NEXTCODE

  EFIG: +
    SET &L = :EFIG.
    ISREDIT  LINE .ZCSR = (L)
    IF &NRSTR(&L2) NE &STR()  THEN  DO
      ISREDIT CHANGE ':FIG ' ':FIG DEPTH=PAGE ' PREV 1 6
      ISREDIT SEEK   ':EFIG' 1 6
      DEND
    SET &FG = FALSE
    GOTO NEXTCODE

  ETAB: +
    SET &L = :ETAB.
    ISREDIT  LINE .ZCSR = (L)
    IF &NRSTR(&L2) NE &STR()  THEN  DO
      ISREDIT CHANGE ':TAB ' ':FIG DEPTH=PAGE ' PREV 1 6
      ISREDIT SEEK   ':ETAB' 1 6
      DEND
    SET &FG = FALSE
    GOTO NEXTCODE

  BOXON: +
    IF (&FG = FALSE) THEN  SET &L = &NRSTR(.BX 1 &AMP.$LL.)
    ELSE                   SET &L = &NRSTR(.*    &L)
    ISREDIT  LINE .ZCSR = (L)
    SET &L = &NRSTR(:XMP.)
    IF (&FG = FALSE)   THEN  ISREDIT  LINE_BEFORE .ZCSR = (L)
    SET &FG = TRUE
    IF (&FG = TRUE)  THEN  DO
      ISREDIT CHANGE 'FRAME=NONE' 'FRAME=BOX' PREV
      ISREDIT SEEK   '.BOXON'
      DEND
    GOTO NEXTCODE

  BOXOFF: +
    IF (&FG = FALSE)  THEN  SET &L = &NRSTR(.BX OFF)
    ELSE                    SET &L = &NRSTR(.*    &L)
    ISREDIT  LINE .ZCSR = (L)
    SET &L = &NRSTR(:EXMP.)
    IF (&FG = TRUE)   THEN  ISREDIT  LINE_AFTER .ZCSR = (L)
    SET &FG = FALSE
    GOTO NEXTCODE

  FORM: +
    SET &L = :FORM.
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  EFORM: +
    SET &L = :EFORM.
    ISREDIT  LINE .ZCSR = (L)
    ISREDIT LINE_BEFORE .ZCSR = :FORMNUM.
    GOTO NEXTCODE

  INDEX: +
    SET &L = :INDEX.
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  TOC: +
    SET &L = :TOC.
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  FIGLIST: +
    SET &L = :FIGLIST.
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  TABLIST: +
    SET &L = :TABLIST.
    ISREDIT  LINE .ZCSR = (L)
    GOTO NEXTCODE

  RETURN: +
  ISREDIT CHANGE ':HP1.:EHP1.' '' ALL 1 12 /* DELETE NULL UNDERSCORE */
  ISREDIT USER_STATE = (STATE)     /* RESTORE EDITING STATE */
  ISPEXEC VPUT (UNPROC) SHARED
  EXIT CODE(&LCC)

./ ADD NAME=XEM
)ATTR
 ^ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW) HILITE(REVERSE)
 ! TYPE(TEXT) INTENS(HIGH) COLOR(PINK)
 # TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)
 $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)
 @ TYPE(TEXT) INTENS(LOW)  COLOR(TURQ)
)BODY EXPAND()
%TUTORIAL --- EDIT - MACROS --- TUTORIAL
%COMMAND ===>_ZCMD                                                             +
%
%  ^-------------------+
%  ^|   EDIT MACROS   |+
%  ^-------------------+
+
+
 IBM does not provide any edit macros, but we here at CSDL have established
 edit macros at three levels of support:

    !System-wide macros@(contained in 'CSD.CMD.CLIST')

    !Project-wide macros@(for example, in 'PROGLIB.CMD.CLIST')

    !User macros@(which you code in your CMD.CLIST or CMD.LOAD)

+The following topics are presented in sequence, or may be selected by number:

     %1+-$System-wide macros
     %2+-$Project-wide macros
     %3+-$User macros
)PROC
     &ZSEL = TRANS( &ZCMD
                1,XEMACROS
                2,YEMACROS
                3,ZEMACROS
                *,'?'
                )
)END
./ ADD NAME=XEMACROS
)ATTR
 ^ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW) HILITE(REVERSE)
 ! TYPE(TEXT) INTENS(HIGH) COLOR(RED)
 # TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)
 $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)
)BODY EXPAND(``)
%TUTORIAL -`-`- EDIT - SYSTEM-WIDE MACROS -`-`- TUTORIAL
%COMMAND ===>_ZCMD                                                             +
%
%` ` ^--`-`-------------------------------`-`--+ ` `
%` ` ^| ` ` SYSTEM-WIDE (CSD) EDIT MACROS ` ` |+ ` `
%` ` ^--`-`-------------------------------`-`--+ ` `
+
  This tutorial describes the edit macros available to all users.

  Tutorials for the following macros may be selected by number or name:

     %1#XXCMD   $- Get TSO command output into your data.
     %2#XXD1TAB $- Copy the contents of a D.1 table into your data.
     %3#XXD2BLD $- Convert your data into a format that D.2 can import.
     %4#XXGML   $- Invoke online CSDL GML Summary.
     %5#XXMLIST $- Copy a PDS member list into your data.
     %6#XXNOCC  $- Replace ANSI carriage control with blank lines
     %7#XXPAR   $- Match up left and right parentheses or curly braces.
     %8#XXRENUM $- Non-destructive renumber.
     %9#XXTRACE $- Control macro tracing mode.
    %10#XXUNNUM $- Remove line numbers and realign data.
    %11#XXWSC   $- Convert Waterloo SCRIPT/SYSPUB to IBM DCF/GML.
)PROC
     &ZSEL = TRANS(&ZCMD
                          1,*XXCMD
                   XXCMD   ,*XXCMD
                          2,*XXD1TAB
                   XXD1TAB ,*XXD1TAB
                          3,*XXD2BLD
                   XXD2BLD ,*XXD2BLD
                          4,*XXGML
                   XXGML   ,*XXGML
                          5,*XXMLIST
                   XXMLIST ,*XXMLIST
                          6,*XXNOCC
                   XXNOCC  ,*XXNOCC
                          7,*XXPAR
                   XXPAR   ,*XXPAR
                          8,*XXRENUM
                   XXRENUM ,*XXRENUM
                          9,*XXTRACE
                   XXTRACE ,*XXTRACE
                         10,*XXUNNUM
                   XXUNNUM ,*XXUNNUM
                         11,*XXWSC
                   XXWSC   ,*XXWSC
                          *,'?'
                  )
)END
 01/22/88 - SEB1525 = XXCMD added.
./ ADD NAME=XXWSC,SSI=01010000
)ATTR
 ^ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW) HILITE(REVERSE)
 @ TYPE(TEXT) INTENS(HIGH) COLOR(PINK)
 \ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)
 $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)
)BODY EXPAND()
%TUTORIAL ------------------ EDIT - 'XXWSC' MACRO -------------------   TUTORIAL
%COMMAND ===>_ZCMD                                                             +
%
%  ^--------------------------+
%  ^|   XXWSC - EDIT MACRO   |+
%  ^--------------------------+
+
  Use the%XXWSC+EDIT macro to convert text marked up with University of
  Waterloo SCRIPT and SYSPUB controls to IBM DCF (SCRIPT/VS) controls
  and GML tags.  XXWSC operates on the entire sequential data set or
  member being edited.
+
  The conversion is not complete, and will need some editing to fix up
  the results.  However, XXWSC attempts to convert the following:

% Native Control Words converted -
+
     .FO      --> .FO                   .IX      --> :IH# :H#
     .UD SET                            .HY      --> .DU
     .US      --> :HP1 :EHP1            .EF      --> removed

     Other native controls are not changed

\  (continued on next page)
)INIT
)PROC
 &ZCONT = XXWSC1
)END
./ ADD NAME=XXWSC1,SSI=01000000
)ATTR
 ^ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW) HILITE(REVERSE)
 @ TYPE(TEXT) INTENS(HIGH) COLOR(PINK)
 # TYPE(TEXT) INTENS(HIGH) COLOR(TURQ)
 \ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)
 $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)
)BODY EXPAND()
%TUTORIAL ------------------ EDIT - 'XXWSC' MACRO -------------------   TUTORIAL
%COMMAND ===>_ZCMD                                                             +

% SYSPUB Macros Converted -
+
     .PARA    --> :P                    .XPL     --> :FIG FRAME=BOX
     .POINT   --> :OL :UL :LI           .FIGNUM  --> ID=
     .PART    --> :H0                   .TABNUM  --> ID=
     .APPENDIX--> :APPENDIX :H1         .FIGBEGIN--> :FIG
     .CHAPTER --> :H1                   .TABBEGIN--> :TAB
     .NEWCHAP --> :H1                   .FIGURE  --> :FIGCAP
     .SECTION --> :H2                   .TABLE   --> :TABCAP
     .SUBSECT --> :H3                   .FIGEND  --> :EFIG
     .SUBSUB  --> :H4                   .TABEND  --> :ETAB
     .SUBSUB1 --> :H5                   .BOXON   --> :BOXON FRAME=BOX
     .SUBSUB2 --> :H6                   .BOXOFF  --> :BOXOFF
     .SUBSUB3 --> :H7                   .EQBEGIN --> :FORM
     .SUBSUB4 --> :H8                   .EQEND   --> :EFORM
     .QUOTE   --> :LQ                   .INDEX   --> :INDEX
     .FOOTNOTE--> :FN                   .CONTENTS--> :TOC
     .ENDNOTE --> :FN                   .FIGURES --> :FIGLIST
     .FOOTEND --> :EFN                  .TABLES  --> :TABLIST
     .ENDEND  --> :EFN                  Other controls are not changed
)INIT
)PROC
)END
./ ENDUP
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU