View previous topic :: View next topic
Author
Message
rgupta71 Active User Joined: 21 Jun 2009Posts: 160 Location: Indore
Hi All,
I am trying to generate a list where the key is having only one type of error. which is Error1 in below example
For example
Code:
AAAAA Error1
AAAAA Error1
AAAAA Error1
AAAAA Error2
AAAAA Error2
AAAAA Error3
AAAAA Error3
BBBBB Error1
BBBBB Error1
BBBBB Error1
CCCCC Error2
Output should be
BBBBB Error1
Error can be duplicates for each key.RECFM=FB
Is this possible using sort?
Thanks
Back to top
Garry Carroll Senior Member Joined: 08 May 2006Posts: 1193 Location: Dublin, Ireland
Quote:
Output should be
BBBBB Error1
Error can be duplicates for each key.RECFM=FB
Your requirements are not very clear.
Do you want all records that have Error1, just ones with BBBBB, the first with BBBBB, the last with BBBBB or something else? What are the positions of the fields? What is the LRECL?
Which SORT product are you using - DFSORT or SYNCSORT?
Garry.
Back to top
rgupta71 Active User Joined: 21 Jun 2009Posts: 160 Location: Indore
Records which only have Error1 not any other error.
LRECL is 160.
Key is at 41 position of 10 bytes and Error is at postion 10 of 8 bytes.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
rgupta71,
Use the following DFSORT JCL which will give you the desired results
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input Fb 160 byte file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(161:C'000')),
IFTHEN=(WHEN=GROUP,KEYBEGIN=(41,10),PUSH=(164:10,8)),
IFTHEN=(WHEN=(10,8,CH,NE,164,8,CH),OVERLAY=(163:C'1'))
SORT FIELDS=(41,10,CH,A),EQUALS
SUM FIELDS=(161,3,ZD)
OUTFIL BUILD=(1,160),INCLUDE=(161,3,ZD,EQ,0,AND,10,8,CH,EQ,C'ERROR1')
//*
Back to top
rgupta71 Active User Joined: 21 Jun 2009Posts: 160 Location: Indore
I am getting below error.
Code:
IFTHEN=(WHEN=GROUP,KEYBEGIN=(41,10)
$
OPERAND DEFINER ERROR
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
rgupta71,
Looks like your shop does not have the ptf which supports KEYBEGIN parm. Ask your System Programmer to install it (it's free). Use the following Control cards.
Code:
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(161:3C'0',SEQNUM,3,ZD,RESTART=(41,10))),
IFTHEN=(WHEN=GROUP,BEGIN=(164,3,ZD,EQ,1),PUSH=(167:10,8)),
IFTHEN=(WHEN=(10,8,CH,NE,167,8,CH),OVERLAY=(163:C'1'))
SORT FIELDS=(41,10,CH,A),EQUALS
SUM FIELDS=(161,3,ZD)
OUTFIL BUILD=(1,160),INCLUDE=(161,3,ZD,EQ,0,AND,10,8,CH,EQ,C'ERROR1')
//*
Back to top
Please enable JavaScript!