Joined: 15 Feb 2005 Posts: 7129 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.
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 ***************************************************
Joined: 11 Oct 2007 Posts: 7 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?
Joined: 07 Dec 2007 Posts: 2205 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?
Joined: 11 Oct 2007 Posts: 7 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
Joined: 15 Feb 2005 Posts: 7129 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: