|
|
| Author |
Message |
stly Warnings : 1 Active User
Joined: 25 Jul 2005 Posts: 103
|
|
|
|
Hi i have done some code changes by adding the comments as below starting from the 7th column.
* 1.14567 BEGIN ****************
code
* 1.14567 END ****************
Is there any way to copy the code between the specified delimiters using DFSORT. |
|
| Back to top |
|
 |
References
|
|
 |
Manuneedhi K
Active User
Joined: 07 May 2008 Posts: 121 Location: Chennai
|
|
|
|
Where does these comments reside?
Are you referring to concatenating two datasets and having the data in the 2nd dataset between these to records ? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4613 Location: San Jose, CA
|
|
|
|
stly,
It's not clear what you want to do. Are there other records before and/or after these records? Are you trying to copy the records starting at the BEGIN line and ending at the END line, and eliminate the other records before and after those records?
Please show a better example of the input records and what you want for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields and constants. |
|
| Back to top |
|
 |
stly Warnings : 1 Active User
Joined: 25 Jul 2005 Posts: 103
|
|
|
|
| Frank Yaeger wrote: |
stly,
It's not clear what you want to do. Are there other records before and/or after these records? Are you trying to copy the records starting at the BEGIN line and ending at the END line, and eliminate the other records before and after those records?
Please show a better example of the input records and what you want for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields and constants. |
Thanks Frank for ur reply..
Let me explain you with an example..
I am changing my cobol program.I have added my code in between the limiters
* 1.14567 BEGIN ****************
code
* 1.14567 END ****************
and
* 1.14568 BEGIN ****************
code
* 1.14568 END ****************
Now i need to copy all the code in between the delimiters (including the delimters) in to a PS.The delimters starts from 7th position.
RECFM=F and LREC=80.
| Code: |
Input :
IF RERVAL NOT EQUAL SPACES
* 1.14567 BEGIN *************************************************
* MOVE ATMVA TO INS-SER
MOVE ATMVA TO INS-VER
* 1.14567 END ***************************************************
MOVE LINE29 TO T-SERV
PERFORM 8000-PRINT-REC
THRU 8999-PRINT-REC-EXIT
* 1.14568 BEGIN *************************************************
* MOVE ATMV1 TO INS-SER1
MOVE ATMV1 TO INS-VER1
* 1.14568 END ***************************************************
PERFORM 8000-REC
THRU 8999-REC-EXIT.
Output:
* 1.14567 BEGIN *************************************************
* MOVE ATMVA TO INS-SER
MOVE ATMVA TO INS-VER
* 1.14567 END ***************************************************
* 1.14568 BEGIN *************************************************
* MOVE ATMV1 TO INS-SER1
MOVE ATMV1 TO INS-VER1
* 1.14568 END ***************************************************
|
|
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 357 Location: San Jose
|
|
|
|
The following DFSORT JCl will give you the desired results
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
IF RERVAL NOT EQUAL SPACES
* 1.14567 BEGIN *************************************************
* MOVE ATMVA TO INS-SER
MOVE ATMVA TO INS-VER
* 1.14567 END ***************************************************
MOVE LINE29 TO T-SERV
PERFORM 8000-PRINT-REC
THRU 8999-PRINT-REC-EXIT
* 1.14568 BEGIN *************************************************
* MOVE ATMV1 TO INS-SER1
MOVE ATMV1 TO INS-VER1
* 1.14568 END ***************************************************
PERFORM 8000-REC
THRU 8999-REC-EXIT.
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(81,8,CH) -
WITHALL WITH(1,80) KEEPNODUPS KEEPBASE USING(CTL1)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=((1,1,CH,EQ,C'*',AND,11,5,CH,EQ,C'BEGIN'),OR,
(1,1,CH,EQ,C'*',AND,11,3,CH,EQ,C'END')),
OVERLAY=(81:SEQNUM,8,ZD,1,15)),
IFTHEN=(WHEN=NONE,
OVERLAY=(89:SEQNUM,8,ZD,
81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))
SORT FIELDS=COPY
OUTFIL FNAMES=OUT,REMOVECC,BUILD=(01,80),
INCLUDE=(89,15,SS,EQ,C'BEGIN'),
SECTIONS=(89,15,
TRAILER3=(89,10,' END ',65'*'))
/*
|
Hope this helps...
Cheers |
|
| Back to top |
|
 |
Ed Groneman
New User
Joined: 11 Oct 2007 Posts: 5 Location: Cincinnati, OH
|
|
|
|
Input file like this:
FH$ 158 70API810 APIFLAT 080616144835
BH$ 188IN 7000001
ST 054810 11211
BIG 10020080531LZ35148
N1 021RE IRON MOUNTAIN INC.
BT$ 001
FT$ 001
FH$ 158 100020API810X APIFLAT 080616144836
BH$ 188IN 10002000001
ST 054810 1
BIG 10020080516102748003
REF 062CA 00051705414 05144
Need output file to contain the FH$ record and all succeeding records until I hit the next FH$ record then that should be written to new file with it's succeeding records, etc. File will always start with FH$ record. Can this be done with SPLIT since there is never a set # of records associated with each FH$ record? Or must it be done with a loop in Cobol?
Thanks for your reply
Ed |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 357 Location: San Jose
|
|
|
|
| Ed Groneman wrote: |
Need output file to contain the FH$ record and all succeeding records until I hit the next FH$ record then that should be written to new file with it's succeeding records, etc. File will always start with FH$ record. Can this be done with SPLIT since there is never a set # of records associated with each FH$ record? Or must it be done with a loop in Cobol?
Thanks for your reply
Ed |
Do you mean to split each FH$ block into a new file? Do you know how many blocks do you have? We can split the Records into blocks , but you may run out off DD names . If there is a reasonable number (<=99) then we can show you an example of splitting the data.
What is the LRECL and RECFM of the input and output datasets? |
|
| Back to top |
|
 |
Ed Groneman
New User
Joined: 11 Oct 2007 Posts: 5 Location: Cincinnati, OH
|
|
|
|
| Yes each FH$ block would be in a separate file but would be well under 99 total files. lrecl=516 and recfm=vb |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 357 Location: San Jose
|
|
|
|
Ed Groneman
The following DFSORT JCL will give you the desired results
| Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&T1,DISP=SHR
//OUT01 DD SYSOUT=*
//OUT02 DD SYSOUT=*
//OUT03 DD SYSOUT=*
....
//OUT99 DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,ZD,8X,5)),
IFTHEN=(WHEN=(21,3,CH,EQ,C'FH$'),OVERLAY=(5:SEQNUM,8,ZD)),
IFTHEN=(WHEN=NONE,OVERLAY=(13:SEQNUM,8,ZD,
05:05,8,ZD,SUB,13,8,ZD,M11,LENGTH=8))
SORT FIELDS=COPY
OUTFIL FNAMES=OUT01,INCLUDE=(5,8,ZD,EQ,01),BUILD=(1,4,21)
OUTFIL FNAMES=OUT02,INCLUDE=(5,8,ZD,EQ,02),BUILD=(1,4,21)
OUTFIL FNAMES=OUT03,INCLUDE=(5,8,ZD,EQ,03),BUILD=(1,4,21)
....
OUTFIL FNAMES=OUT99,INCLUDE=(5,8,ZD,EQ,99),BUILD=(1,4,21)
/*
|
Hope this helps....
Cheers |
|
| Back to top |
|
 |
Ed Groneman
New User
Joined: 11 Oct 2007 Posts: 5 Location: Cincinnati, OH
|
|
|
|
Yes, that worked perfectly! Thanks.
Ed |
|
| Back to top |
|
 |
Ed Groneman
New User
Joined: 11 Oct 2007 Posts: 5 Location: Cincinnati, OH
|
|
|
|
Kolusu - New twist - I now need to further define the FH$ records using a unique vendor # on the record. How can I change the INREC statements to also use the vendor # (bold columns on FH$ rec)? In other words, I need to write the outfil files based on FH$ and the vendor #. How would I specify that?
FH$ 158 70API810 APIFLAT 080616144835
BH$ 188IN 7000001
ST 054810 11211
BIG 10020080531LZ35148
N1 021RE IRON MOUNTAIN INC.
BT$ 001
FT$ 001
FH$ 158 100020API810X APIFLAT 080616144836
BH$ 188IN 10002000001
thanks again,
Ed |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 357 Location: San Jose
|
|
|
|
Ed Groneman,
Assuming that the vendor number starts at 35 (31 + 4 byte rdw) the following DFSORT/ICETOOL JCL will give you the desired results
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=your input vb file,DISP=SHR
//OUT DD DUMMY
//OUT01 DD SYSOUT=*
//OUT02 DD SYSOUT=*
...
//OUT99 DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(517,8,CH) KEEPNODUPS WITHALL -
WITH(5,512) KEEPBASE USING(CTL1)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(517:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(5,3,CH,EQ,C'FH$'),OVERLAY=(517:SEQNUM,8,ZD,35,12)),
IFTHEN=(WHEN=NONE,OVERLAY=(525:SEQNUM,8,ZD,
517:517,8,ZD,SUB,525,8,ZD,M11,LENGTH=8))
SORT FIELDS=COPY
OUTFIL FNAMES=OUT01,BUILD=(1,4,5,512),
INCLUDE=(525,12,CH,EQ,C'080616144835')
OUTFIL FNAMES=OUT02,BUILD=(1,4,5,512),
INCLUDE=(525,12,CH,EQ,C'080616144836')
....
OUTFIL FNAMES=OUT99,BUILD=(1,4,5,512),
INCLUDE=(525,12,CH,EQ,C'nnnnnnnnnnnnn')
/* |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4613 Location: San Jose, CA
|
|
|
|
You can do this kind of thing more easily and efficiently with the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008). Here's the job for stly's requirement:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
IF RERVAL NOT EQUAL SPACES
* 1.14567 BEGIN *************************************************
* MOVE ATMVA TO INS-SER
MOVE ATMVA TO INS-VER
* 1.14567 END ***************************************************
MOVE LINE29 TO T-SERV
PERFORM 8000-PRINT-REC
THRU 8999-PRINT-REC-EXIT
* 1.14568 BEGIN *************************************************
* MOVE ATMV1 TO INS-SER1
MOVE ATMV1 TO INS-VER1
* 1.14568 END ***************************************************
PERFORM 8000-REC
THRU 8999-REC-EXIT.
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,1,CH,EQ,C'*',AND,11,5,CH,EQ,C'BEGIN'),
END=(1,1,CH,EQ,C'*',AND,11,3,CH,EQ,C'END'),
PUSH=(81:ID=1))
OUTFIL INCLUDE=(81,1,CH,NE,C' '),BUILD=(1,80)
/*
|
For complete details on the WHEN=GROUP function and the other new functions available with PTF UK90013, see:
www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/ |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4613 Location: San Jose, CA
|
|
|
|
Here's the DFSORT WHEN=GROUP job for Ed Groneman's last request:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB/516)
//OUT01 DD DSN=... output file1 (VB/516)
//OUT02 DD DSN=... output file2 (VB/516)
...
//OUT99 DD DSN=... output file99 (VB/516)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,17:5)),
IFTHEN=(WHEN=GROUP,BEGIN=(17,3,CH,EQ,C'FH$'),
PUSH=(5:51,12))
OUTFIL FNAMES=OUT01,
INCLUDE=(5,12,CH,EQ,C'080616144835'),
BUILD=(1,4,5:17)
OUTFIL FNAMES=OUT02,
INCLUDE=(5,12,CH,EQ,C'080616144836'),
BUILD=(1,4,5:17)
...
OUTFIL FNAMES=OUT99,
INCLUDE=(5,12,CH,EQ,C'nnnnnnnnnnnn'),
BUILD=(1,4,5:17)
/*
|
|
|
| Back to top |
|
 |
|
|
|