View previous topic :: View next topic
|
Author |
Message |
Srinivasan Selvam
New User
Joined: 25 May 2012 Posts: 11 Location: india
|
|
|
|
Hi all,
I am trying to find the occurence of a Key field and one more value using sort and need to report the first occurence of Key field only.
My Input:
1111111 99
2222222 99
3333333 96
3333333 97 L
3333333 98 L
3333333 99 L
4444444 98
4444444 99
5555555 97
5555555 98 L
5555555 99
Expected output:
1111111 99
2222222 99
3333333 96 3
4444444 99
5555555 98 1
I need the occurrence of value 'L' and if found, I need to populate with the first record (refer 33333333 record).
I tried with OCCUR ON(1,8,CH) ON(13,1,CH) ON(VALCNT,U01). But not getting desired results.
I give a try. Would like someone to throw a light on this.
Thanks,
Srinivasan Selvam |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
Please, you must use the Code Tag Button when posting code/data. Also, what results have you got instead? |
|
Back to top |
|
|
Srinivasan Selvam
New User
Joined: 25 May 2012 Posts: 11 Location: india
|
|
|
|
Hi,
I tried the below, which is incorrect.
FYI...
JCL:
Code: |
//JSTEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
11111111 99
22222222 99
33333333 96
33333333 97 L
33333333 98 L
33333333 99 L
44444444 98 L
44444444 99
55555555 97
55555555 98 L
55555555 99 L
//OUT1 DD DSN=XXXX.OUT,DISP=OLD
//TOOLIN DD *
OCCUR FROM(IN1) LIST(OUT1) NOHEADER BLANK -
ON(1,12,CH) ON(13,1,CH) ON(VALCNT,U03)
/* |
Output:
Code: |
11111111 1
22222222 1
33333333 1
33333333 L 3
44444444 1
44444444 L 1
55555555 1
55555555 L 2
|
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
Something is wrong with your request. See for 3's and 5's. The Fives in your statement renders this invalid. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
Maybe this is what you whish. You should review your requirements before posting (Offsets/Lengths and such).
Code: |
//WHATEVER EXEC PGM=ICEMAN
//SORTIN DD *
11111111 99
22222222 99
33333333 96
33333333 97 L
33333333 98 L
33333333 99 L
44444444 98 L
44444444 99
55555555 97
55555555 98 L
55555555 99 L
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION EQUALS
INREC IFTHEN=(WHEN=(13,1,CH,EQ,C' '),OVERLAY=(13:+0,ZD,LENGTH=1)),
IFTHEN=(WHEN=NONE,OVERLAY=(13:+1,ZD,LENGTH=1))
SORT FIELDS=(1,8,ZD,A)
SUM FIELDS=(13,1,ZD)
OUTFIL BUILD=(1,12,13,1,CHANGE=(1,C'0',C' '),NOMATCH=(13,1))
END
/* |
|
|
Back to top |
|
|
Srinivasan Selvam
New User
Joined: 25 May 2012 Posts: 11 Location: india
|
|
|
|
Hi Joe,
Appreciate your quick help!. It really worked. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
My name is Joerg. |
|
Back to top |
|
|
|
|