Joined: 22 Mar 2009 Posts: 161 Location: South Africa
Hi,
I have a below sort card and apparently in my file only I always get only one group of records which satisfies the below WHEN=GROUP and from that I am able to find the below include condition which gives me one group.
But my query is if there are multiple groups which fullfill the below scenario then how my INCLUDE will work.
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
Good Day,
I tried the below code:
Code:
//SYSIN DD *
*GET THE GROUP OF RECORDS WHICH HAS 01 AND 99 AT POSITIONS *
*01 AND 92 RESPECTIVELY ON HEADER AND 99 AT POSITION 01 ON TRAILER *
OPTION COPY
INREC IFTHEN(WHEN=GROUP,
BEGIN=(1,2,CH,EQ,C'01',AND,92,2,CH,EQ,C'99'),
END=(1,2,CH,EQ,C'99'),
PUSH=(251:C'VALID'))
OUTFIL INCLUDE(251,5,CH,EQ,C'VALID'),
BUILD=(1,250)
//*
and the spool is:
Code:
1ICE805I 1 JOBNAME: XXXXRTCL , STEPNAME: SRT01#22
ICE802I 0 BLOCKSET TECHNIQUE IN CONTROL
ICE007A 1 SYNTAX ERROR
ICE751I 0 C5-K76982 C6-K90026 C7-K58148 C8-K67572 E7-K79990
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 15:16 ON THU MAY 30, 2013 -
0 *GET THE GROUP OF RECORDS WHICH HAS 01 AND 99 AT POSITIONS *
*01 AND 92 RESPECTIVELY ON HEADER AND 99 AT POSITION 01 ON TRAILER *
OPTION COPY
INREC IFTHEN(WHEN=GROUP,
BEGIN=(1,2,CH,EQ,C'01',AND,92,2,CH,EQ,C'99'),
END=(1,2,CH,EQ,C'99'),
PUSH=(251:C'VALID'))
$
ICE007A 1 SYNTAX ERROR
OUTFIL INCLUDE(251,5,CH,EQ,C'VALID'),
BUILD=(1,250)
ICE751I 0 C5-K76982 C6-K90026 C7-K58148 C8-K67572 E7-K79990
ICE052I 3 END OF DFSORT
You can use the following in PUSH:
c: Specifies the output position (column) to be overlaid. If you do not
specify c: for the first item, it defaults to 1:. If you do not specify c:
for any other item, it starts after the previous item. You can specify
items in any order and overlap output columns. c can be 1 to
32752.
If you specify an item that extends the output record beyond the
end of the input record, the record length is automatically
increased to that length, and blanks are filled in on the left as
needed. For variable-length records, the RDW length is increased
to correspond to the larger record length after all of the items are
processed. Missing bytes in specified input fields are replaced with
blanks so the padded fields can be processed.
p,m
Specifies a field in the first input record of each group to be
propagated to every record of the group. p specifies the starting
position of the field in the input record and m specifies its length.
A field must not extend beyond position 32752.
ID=n
Specifies a ZD identifier of length n is to be added to every record
of each group. The identifier starts at 1 for the first group and is
incremented by 1 for each subsequent group. n can be 1 to 15.
SEQ=n
Specifies a ZD sequence number of length n is to be added to
every record of each group. The sequence number starts at 1 for
the first record of each group and is incremented by 1 for each
subsequent record of the group. n can be 1 to 15.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
abhijit.nayak01 wrote:
Can't we do same in PUSH as we can do in OVERLAY=(251:C'VALID')
You have been spoon fed many times about reading the documentation and yet you never pay attention to that. You could have looked the syntax of PUSH by now and understood how different it is from OVERLAY.
Here is the link to the documentation once again. Scroll down to the section WHEN=GROUP clause
But my query is if there are multiple groups which fullfill the below scenario then how my INCLUDE will work.
If you are pushing the id at the end why bother checking for '01'? Think logically and understand what is in positions 251 and you can code an include/omit condition to handle any number of groups.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
abhijit.nayak01 wrote:
Hi Skolusu,
I was actually doing some trial and error method. Thanks to you, Bill and the team for making me comfortable to the DFSORT.
The ID can be only vary from 1-15 which makes the below code working:
Thanks again.
*Sigh* So if for some reason you have more than 15 groups your job would fail? You need to code solutions that accounts for ALL possible scenarios. Just so you know , you don't need that IFTHEN OVERLAY to check if the group number is between 1 and 15. It is as simple as this.