I'm with you - comments are problematic, but you could track the original
physical structure by emitting sequences of attributes as they are found on
each line. For example,

//INPUT  DD    DSN=MY.DATASET,     This is a required
//             BLKSIZE=3120,       input dataset
//             RECFM=FB,LRECL=80   and it must be FB

...could be parsed into something like:

<dd name="INPUT">
  <line>
    <dsn>MY.DATASET</dsn>
    <comment>This is a required</comment>
  </line>
  <line>
     <blksize>3120</blksize>
     <comment>input dataset</comment>
  </line>
  <line>
     <recfm>FB</recfm>
     <lrecl>80</lrecl>
     <comment>and it must be FB</comment>
  </line>
</dd>

But even that's not problem free. Say you wanted to reconstruct a "tidy"
version of the JCL - maybe re-writing all the DCB=(RECFM=FB...) attributes
as just RECFM=FB etc. You would still have trouble reliably associating
input comments to the output JCL - where would a comment originally on the
DCB attribute go? IMHO, it's best to just discard line comments and only
retain block comments.

The JCL2XML rexx (in CBT File 647) implements a compromise by discarding all
but the last comment on a logical statement, producing a more condensed (but
lossy):

<dd _name="INPUT" _comment="and it must be FB" dsn="MY.DATASET"
blksize="3120" recfm="FB" lrecl="80"/>

For comments that are meant to actually document a JCL's function then
perhaps a convention like javadoc would be useful. At the job and step level
you could code "jcldoc" comments something like:

//ACCPAY1 JOB etc
//** Accounts payable archive
//* 
//* @title ACCPAY1
//* @version 1.0
//* @author Joe Bloggs
//* 
//*/
//STEP1 EXEC PROC=FTP,
//           ACTION=PUT,
//           REMHOST='archive',
//           LOCFILE=ACCPAY.DATA,
//           REMFILE='~/accpay.txt'
//           REMUSER='accpay'
//** This step archives some data using using ftp
//*
//* @param action The action to be performed
//* @param remhost The host name of the ftp server
//* @param locfile The local dataset name
//* @param remfile The remote file name
//* @dd NETRC The password dataset
//* @return 0 if all went well
//*/
//NETRC   DD DISP=SHR,DSN=ACCPAY.NETRC

Line comments become superfluous when all the essential commentary is moved
to a block comment.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to