IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Find the occurrence of Key Field (Partial)


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Srinivasan Selvam

New User


Joined: 25 May 2012
Posts: 11
Location: india

PostPosted: Mon Sep 26, 2022 12:16 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1253
Location: Bamberg, Germany

PostPosted: Mon Sep 26, 2022 12:32 pm
Reply with quote

Please, you must use the Code Tag Button when posting code/data. Also, what results have you got instead?
Back to top
View user's profile Send private message
Srinivasan Selvam

New User


Joined: 25 May 2012
Posts: 11
Location: india

PostPosted: Mon Sep 26, 2022 12:44 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1253
Location: Bamberg, Germany

PostPosted: Mon Sep 26, 2022 12:52 pm
Reply with quote

Something is wrong with your request. See for 3's and 5's. The Fives in your statement renders this invalid.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1253
Location: Bamberg, Germany

PostPosted: Mon Sep 26, 2022 1:40 pm
Reply with quote

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
View user's profile Send private message
Srinivasan Selvam

New User


Joined: 25 May 2012
Posts: 11
Location: india

PostPosted: Mon Sep 26, 2022 2:46 pm
Reply with quote

Hi Joe,

Appreciate your quick help!. It really worked.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1253
Location: Bamberg, Germany

PostPosted: Mon Sep 26, 2022 5:40 pm
Reply with quote

My name is Joerg.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top