Page 1 of 2

Struggling with Continuation

PostPosted: Sun Sep 23, 2012 12:33 pm
by Thomas Ramseier
Hi All
I'm struggling with the correct syntax for SYSIN-continuationlines. According to the manual, there is explicit and implicit conitunuation possible, "explicit" meaning Non-Blank in Col 71, nonblank on 72 and continuation on pos. 16 line 2, "implicit" meaning nonblank on pos. 71 and 72, continuation somewhere between 2 and 15 on line 2. I'd need explicit continuation since pos. 16 on line 2 will be a blank (I'd like to have the keyword INREC on line 1 and then generate several IFTHEN-lines thereafter). For testing, I used a simple OPTION COPY - trying to write OPTION on line 1 and COPY on line 2.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
*---+----1----+----2----+----3----+----4----+----5----+----6----+----7---
                                                                 OPTION*
                COPY

When submitting the job, it ends with RC16
1ICE805I 1 JOBNAME: T750KPX3 , STEPNAME: STEP0150
 ICE802I 0 BLOCKSET     TECHNIQUE IN CONTROL
 ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 08:54 ON SUN SEP 23, 2012 -
0          *---+----1----+----2----+----3----+----4----+----5----+----6----+----7---
                                                                            OPTION*
                                                                            $
 ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
                           COPY
 ICE010A 0 NO SORT OR MERGE CONTROL STATEMENT
 ICE751I 0 C5-K62149 C6-K90026 E7-K70685
 ICE052I 3 END OF DFSORT


Here's the JCL as well
//STEP0150 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
Dummy Record
//SORTOUT  DD SYSOUT=*
//SYSIN DD *
*---+----1----+----2----+----3----+----4----+----5----+----6----+----7---
                                                                 OPTION*
                COPY


Does anybody have a suggestion what I'm doing wrong?
Thanks a lot
Thomas

Re: Struggling with Continuation

PostPosted: Sun Sep 23, 2012 1:00 pm
by BillyBoyo
I can't see any non-blanks over in the columns you have mentioned.

I think you are making a lot of work for yourself.

I'm not sure it is going to work out how you expect.

Whilst it might be nice to be able to make it look like you can an IDCAMS statement, you are not going to be able to.

Just as s shot at it, show the layout of an IFTHEN on INREC that you'd like to see. The OPTION is too simple for you to decide whether or not the formatting you want is going to work.

Re: Struggling with Continuation

PostPosted: Sun Sep 23, 2012 3:07 pm
by Thomas Ramseier
Thank you for your response.

SYSIN currently looks like:
//SYSIN     DD   *
*
  INREC  IFTHEN=(WHEN=(57,8,SS,EQ,C'VID-PR06'),
                      OVERLAY=(57:C'VID38971')),
         IFTHEN=(WHEN=(57,8,SS,EQ,C'VID-XXXX'),
                      OVERLAY=(57:C'VIDYYYYY')),
        IFOUTLEN=80
        OPTION COPY
*


and I would like to have all the IFTHEN-Statements in a temporary file generated in a previuos step, like this:
//STEP0010 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//TMPFILE1 DD SYSOUT=*
//TMPPRINT DD DSN=&&TMPSYMB1,DISP=(,PASS),
//             UNIT=VIO,SPACE=(TRK,(1),RLSE),
//             LRECL=80,RECFM=FB
//SORTIN   DD *
VID-PR06,VID38971
VID-XXXX,VIDYYYYY
//SORTOUT  DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OUTFIL FNAMES=(TMPFILE1,TMPPRINT),
  OUTREC=(16:C'IFTHEN=(WHEN=(57,8,SS,EQ,C''',1,8,C'''),'/,
          24:C'OVERLAY=(57:C''',10,8,C''')),',
          80:X)
//*


TMPFILE1 and TMPPRINT now look like:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
               IFTHEN=(WHEN=(57,8,SS,EQ,C'VID-PR06'),
                       OVERLAY=(57:C'VID38971')),
               IFTHEN=(WHEN=(57,8,SS,EQ,C'VID-XXXX'),
                       OVERLAY=(57:C'VIDYYYYY')),


So that the //SYSIN of the following step would contain:
//STEP0020 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=.... my inputfile
//SORTOUT  DD SYSOUT=*
//SYSIN DD *
         INREC
//      DD DISP=SHR,DSN=&&TMPSYMB1     <- containing IFTHEN-stmts
//      DD *
        IFOUTLEN=80                   concatenate SYSIN
        OPTION COPY
*


But I'm not able to get the continuation between INREC and the 1st IFTHEN. There might be a circumvention by using INREC and the 1st IFTHEN-Statement as HEADER1-Statements in the 1st step, but before diving into this, I d'like to be sure that there's no valid continuation in this situation here.

Re: Struggling with Continuation

PostPosted: Sun Sep 23, 2012 5:13 pm
by BillyBoyo
Try

  INREC IFOUTLEN=80,


Then your generated IFTHENs.

That leaves you with the problem of the last line.

I can't try at the moment, but you could try with another IFOUTLEN or IFTHEN=(WHEN=NONE) to "close" the INREC.

Re: Struggling with Continuation

PostPosted: Sun Sep 23, 2012 7:40 pm
by Thomas Ramseier
Hi Bill

Thanks again. Yes, I'll add a "Dummy" IFTHEN=(WHEN=INIT ...or start like you suggested (INREC IFOUTLEN), much smarter that the detour with HEADER1. But since there's no restriction documented in the manual, I'm still wondering whether there could be a way to continue on line 2 with just the INREC-keyword on line 1.

Follwing snippet is from DFSORT Application Programmig Guide:

Explicit continuation in 16: If line 1 breaks at column 71 with a nonblank in column 72, and columns 2-15 of line 2 are blank, DFSORT continues on line 2 with whatever character it finds in column 16 (blank or nonblank). For example:

*        1         2         3         4         5         6         7
*23456789012345678901234567890123456789012345678901234567890123456789012
                                                 INCLUDE COND=(5,4,CH,E*
               Q,C'ABCD')
                                                      SORT FIELDS=(9,3,*
               ZD,A)
                                   OUTREC FIELDS=(1,80,C'BLANK WITHIN A*
                LITERAL')

The above statements will be treated as if they were specified as:

 INCLUDE COND=(5,4,CH,EQ,C'ABCD')
 SORT FIELDS=(9,3,ZD,A)
 OUTREC FIELDS=(1,80,C'BLANK WITHIN A LITERAL')

Attention: You should only start with a blank in column 16 of line 2 if you need a blank as the first character of the continued operand, as shown in the OUTREC statement above. A blank in column 16 of line 2 will be included in the operand and will result in invalid syntax if incorrectly placed. For example:

*        1         2         3         4         5         6         7
*23456789012345678901234567890123456789012345678901234567890123456789012
                                                     SORT FIELDS=(5,4,Z*
               D,A)
                                                      SUM FIELDS=(5,4,Z*
                D)

The above statements will be treated as if they were specified as:

 SORT FIELDS=(5,4,ZD,A)
 SUM FIELDS=(5,4,Z D)


Thank you again for your support
Thomas

Re: Struggling with Continuation

PostPosted: Sun Sep 23, 2012 10:10 pm
by BillyBoyo
Well, try putting INREC with * (or any non-blank) in column 72.

Then start your IFTHEN somewhere in cols 2-15.

The implicit continuation is, for me, easier to use/maintain.

Re: Struggling with Continuation

PostPosted: Sun Sep 23, 2012 11:42 pm
by NicC
What is wrong with standard continuation? This I have just run ...
  SORT FIELDS=(1,1,ZD,A,9,1,ZD,A)
  OUTFIL FNAMES=SORTOUT1,
//          DD DSN=N13964.JCL.SORT(INCTEST),DISP=SHR
//          DD *
  OUTFIL FNAMES=SORTOUT2,
     INCLUDE=(1,1,ZD,EQ,0,OR,
              20,1,ZD,EQ,2,OR,
              1,1,ZD,EQ,9)

Or, as Dick S. would say, am I missing something?

Re: Struggling with Continuation

PostPosted: Mon Sep 24, 2012 2:54 am
by BillyBoyo
NicC,

If generating IFTHEN statements to be concatenated with the reset of the Sort control cards (some before, some after) a problem arises.

IFTHEN=(stuff),
IFTHEN=(stuff),
IFTHEN=(stuff),
IFTHEN=(stuff),
IFTHEN=(stuff),
IFTHEN=(stuff)


The first five must have a final comma, the last must not.

Unlike a general-purpose language, it is not so easy to identify this in DFSort (or other Sorts, as far as I know) the way Thomas wants to do it (avoiding the reporting functions of DFSort).

I think I read something by Frank Yaeger saying that the original continuation structure in DFSort was thought to be from the original continuation structure forAssembler. Not the way Frank would have done it by choice, but not possible to change due to backwards-compatability.

The need for a "top and tail" to INREC, OUTREC and OUTFIL either ends up with a little "fudge" for easy generation of a correct syntax or more code than it might seem should be required.

Re: Struggling with Continuation

PostPosted: Mon Sep 24, 2012 9:44 pm
by skolusu
Thomas Ramseier,

You have a couple of issues with your control cards. You just cannot have INREC/OUTREC/OUTFIL on one line and then have the other parameter on other lines. you need to have at least 1 parm after INREC.

If your intention is to generate IFTHEN statements then I suggest you use reporting features (Header1 and Trailer1) to add text at the beginning and append at the end.

To identify the first record you can add a seqnum at the end and validate it.

Here is an example.

//STEP0010 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
VID-PR06,VID38971                                               
VID-XXXX,VIDYYYYY                                               
//TMPFILE1 DD SYSOUT=*                                           
//TMPPRINT DD DSN=&&TMPSYMB1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *                                                     
  OPTION COPY                                                   
  INREC OVERLAY=(81:SEQNUM,8,ZD)                                 
                                                                 
  OUTFIL FNAMES=(TMPFILE1,TMPPRINT),                             
  REMOVECC,HEADER1=(3:'OPTION COPY',80:X),                       
  IFTHEN=(WHEN=(81,8,ZD,EQ,1),                                   
  BUILD=(3:C'INREC IFTHEN=(WHEN=(57,8,SS,EQ,C''',1,8,C'''),'/,   
         8:C'OVERLAY=(57:C''',10,8,C''')),',80:X)),             
  IFTHEN=(WHEN=NONE,                                             
  BUILD=(3:C'IFTHEN=(WHEN=(57,8,SS,EQ,C''',1,8,C'''),'/,         
         8:C'OVERLAY=(57:C''',10,8,C''')),',80:X)),             
  TRAILER1=(3:'IFOUTLEN=80',80:X)                               
//*


This will generate the control cards as follows

  OPTION COPY                                 
  INREC IFTHEN=(WHEN=(57,8,SS,EQ,C'VID-PR06'),
       OVERLAY=(57:C'VID38971')),             
  IFTHEN=(WHEN=(57,8,SS,EQ,C'VID-XXXX'),       
       OVERLAY=(57:C'VIDYYYYY')),             
  IFOUTLEN=80                                 

Re: Struggling with Continuation

PostPosted: Tue Sep 25, 2012 10:36 am
by Thomas Ramseier
Hi All
Thank you for your suggestions and have a great time
Thomas