Page 1 of 1

Create output from 5 inputs, splicing & findreplace

PostPosted: Thu Apr 08, 2010 3:39 pm
by Kevin Jenkins
The end result is already met using a non-DFSORT solution. I am required, however, to convert the process to DFSORT, and through testing I have arrived at the sequence below. This produces the correct result, but it has quite a lot of hops, and so I was wondering if there was a smarter DFSORT/ICETOOL way of going about this.

In Summary:
INPUT1 contains a record which provides output print formatting.
INPUT2 contains a record which is output.
INPUT3 contains a date (dd/mm/yy) value which is to be overlaid on the record output from INPUT2.
INPUT4 contains a record which begins with x'15' between each word. Each x'15' is to be replaced by x'40' in the output.
INPUT9 contains a record which provides print formatting record, and another record which is output.

Grateful for advice.
Regards, Kevin

//STEP010  EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//TMP1     DD DSN=&&TMP1,DISP=(,PASS),                 
//         UNIT=SYSDA,SPACE=(TRK,1),RECFM=FBA,LRECL=255
//TMP2     DD DSN=&&TMP2,DISP=(MOD,PASS),               
//         UNIT=SYSDA,SPACE=(TRK,1),RECFM=FBA,LRECL=255
//TMP3     DD DSN=&&TMP3,DISP=(,PASS),                 
//         UNIT=SYSDA,SPACE=(TRK,1),RECFM=FBA,LRECL=255
//INPUT1   DD *                                         
1¬$FMT = "Portrait"!                                   
//INPUT2   DD *                                         
  >>PRINTED XXXXXXXXXX ACKNOWLEDGEMENTS START           
//INPUT3   DD *                                         
07/04/10                                               
//INPUT4   DD *                                         
  THIS IS A INPUT4 DATA RECORD     
//INPUT9   DD *                                         
1¬$FMT = "Portrait"!                                   
  >>PRINTED XXXXXXXXXX ACKNOWLEDGEMENTS END             
//OUTPUT1  DD SYSOUT=*                                 
//TOOLIN   DD *                                               
  COPY FROM(INPUT1) TO(TMP1)                                   
  COPY FROM(INPUT2) TO(TMP2) USING(DFS1)                       
  COPY FROM(INPUT3) TO(TMP2) USING(DFS2)                       
  SPLICE FROM(TMP2) TO(TMP3) ON(81,2,PD) WITH(41,8) USING(DFS3)
  COPY FROM(TMP1)   TO(OUTPUT1)                               
  COPY FROM(TMP3)   TO(OUTPUT1)                               
  COPY FROM(INPUT4) TO(OUTPUT1) USING(DFS4)                   
  COPY FROM(INPUT9) TO(OUTPUT1)                               
//DFS1CNTL DD *                                               
  OUTREC BUILD=(1:1,45,81:SEQNUM,2,PD)                         
  OPTION STOPAFT=1                                             
//DFS2CNTL DD *                                               
  OUTREC BUILD=(41:1,8,81:SEQNUM,2,PD)                         
  OPTION STOPAFT=1                                             
//DFS3CNTL DD *                                               
  OUTFIL FNAMES=TMP3,BUILD=(1,48,207X)                         
//DFS4CNTL DD *                                               
  OUTREC FINDREP=(IN=X'15',OUT=X'40')                         
  OPTION COPY

...produces output. Note date (dd/mm/yy) has been overlaid on the record that originated from INPUT2, and (although you cannot see it here) x'40' has replaced each x'15' in the record that originated from INPUT4.

1¬$FMT = "Portrait"!                           
  >>PRINTED XXXXXXXXXX ACKNOWLEDGEMENTS 07/04/10
    THIS IS A INPUT4 DATA RECORD               
1¬$FMT = "Portrait"!                           
  >>PRINTED XXXXXXXXXX ACKNOWLEDGEMENTS END     
                                                 

Re: Create output from 5 inputs, splicing & findreplace

PostPosted: Thu Apr 08, 2010 9:00 pm
by skolusu
Kevin Jenkins ,

There is a much easier way to do it and you really don't need that many passes of data. I need the following Details

1. What is the LRECL and RECFM of all input files? Are they all of same lrecl and recfm?
2. Is there any thing in these files which can be used to distinguish as to which file the record came?
Also please run the following job and show me the entire sysout

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *
A
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  SORT FIELDS=COPY   
//*

Re: Create output from 5 inputs, splicing & findreplace

PostPosted: Fri Apr 09, 2010 2:01 pm
by Kevin Jenkins
Skolusu, thanks for your reply. I forgot to mention that our latest maintenance was PTF UK900913. I have run the job step and posted the SYSOUT as you requested. As for the input files their attributes are are as follows ...

INPUT3 is RECFM=FB,LRECL80
INPUT4 is RECFM=FBA,LRECL=255
I may have some latitude with the rest (INPUT1,2 and 9). My preference is RECFM=FB,LRECL80 as this would encourage the job owner to locate those records in an existing data library. If it helps you these records do not necessarily have to be spread across three separate INPUTn files they could be co-located.

OUTPUT1 which I have shown as a SYSOUT will in fact be a NEW,CATLG data set which will be RECFM=FBA,LRECL=255.

Regards, Kevin

ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 09:01 ON FRI APR
            SORT FIELDS=COPY                                                   
ICE201I G RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE751I 0 C5-K51706 C6-K51706 C7-K51706 C8-K51706 E9-K51706 C9-BASE   E5-K51706
ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED   
ICE088I 0 U003364S.STEP0100.        , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6278238)                                 
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6200798,6200798)                           
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERE
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=NO   ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE    ,EXITC
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMI
ICE235I 0 OPTIONS: NULLOUT=RC0                                                 
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT                                   
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN                                   
ICE751I 1 EF-K49534 F0-K30362 E8-K51706                                         
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 80, TYPE = FB                           
ICE055I 0 INSERT 0, DELETE 0                                                   
ICE054I 0 RECORDS - IN: 1, OUT: 1                                               
ICE052I 0 END OF DFSORT                                                         

Re: Create output from 5 inputs, splicing & findreplace

PostPosted: Fri Apr 09, 2010 8:09 pm
by Kevin Jenkins
Skolusu, re Is there any thing in these files which can be used to distinguish as to which file the record came? then I don't have a good handle on the business data in INPUT4. That data is certainly very different and less formatted/predictable than the date that comes from INPUT3, and the two header records that go before it - see what I listed in INPUT1,2 and the two trailer records after it - see what I had in INPUT9.

Regards, Kevin

Re: Create output from 5 inputs, splicing & findreplace

PostPosted: Fri Apr 09, 2010 9:55 pm
by skolusu
Kevin,

Your sysout shows that you do have the latest PTF which supports joinkeys. Here is a job which would give you the desired results.

step0100 - concatenate input 1, 2, and input 9 to SORTJNF1 and input 3 to SORTJNF2 and use joinkeys to overlay the first 8 bytes from input3 onto the record.

This will also create 2 files with a length of 255. FF2(will have the first 2 records and LL2 (will have the last 2 records)

Step0200 just concatenates all the files and does the replacing of x'15' with x'40'


//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTJNF1 DD *                                                       
1¬$FMT = "PORTRAIT"!                                                 
//         DD *                                                       
  >>PRINTED XXXXXXXXXX ACKNOWLEDGEMENTS START                         
//         DD *                                                       
1¬$FMT = "PORTRAIT"!                                                 
  >>PRINTED XXXXXXXXXX ACKNOWLEDGEMENTS END                           
//SORTJNF2 DD *                                                       
07/04/10                                                             
//FF2      DD DSN=&&FF2,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE),RECFM=FBA
//LL2      DD DSN=&&LL2,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE),RECFM=FBA
//SYSIN    DD *                                                       
  JOINKEYS FILES=F1,FIELDS=(81,1,A)                                   
  JOINKEYS FILES=F2,FIELDS=(81,1,A)                                   
  REFORMAT FIELDS=(F1:1,80,F2:1,8) 
  SORT FIELDS=COPY

  OUTREC IFTHEN=(WHEN=(41,5,CH,EQ,C'START'),BUILD=(1,40,81,8,255:X)),
  IFTHEN=(WHEN=NONE,BUILD=(1,80,255:X))                               

  OUTFIL FNAMES=FF2,ENDREC=2                                         
  OUTFIL FNAMES=LL2,STARTREC=3
//JNF1CNTL DD *                                                       
  INREC OVERLAY=(81:X)                                               
//JNF2CNTL DD *                                                       
  INREC OVERLAY=(81:X)                                               
//*
//STEP0200 EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD DSN=&&FF2,DISP=SHR     
//         DD DSN=your Input 4 dsn,DISP=SHR
//         DD DSN=&&LL2,DISP=SHR     
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                       
  SORT FIELDS=COPY                   
  OUTREC FINDREP=(IN=X'15',OUT=X'40')
//*

Re: Create output from 5 inputs, splicing & findreplace

PostPosted: Fri Apr 09, 2010 10:06 pm
by skolusu
Btw if ">>PRINTED XXXXXXXXXX ACKNOWLEDGEMENTS" is a constant value we can avoid all input 1,2,9 as we can create it from the input 3 file itself.

Re: Create output from 5 inputs, splicing & findreplace

PostPosted: Wed Apr 14, 2010 1:16 am
by Kevin Jenkins
Skolusu,thanks for your latest post including solution. I'm away on holiday at the moment, so I am not in a position to test and confirm. I hope to be able to do that early next week. Re INPUT3 which you referred to, this is the file containing the date which is overlaid on line 2. This date value is maintained by an entirely separate process. As far as this process is concerned it just reads it in from the specified location.

Regards, Kevin

Re: Create output from 5 inputs, splicing & findreplace

PostPosted: Mon Apr 26, 2010 9:54 pm
by Kevin Jenkins
Skolusu,

Solution looks good. Many thanks.

Cheers, Kevin