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

Need assistance with PUSH.


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chillmo

New User


Joined: 31 Aug 2017
Posts: 54
Location: USA

PostPosted: Thu Feb 27, 2025 1:29 am
Reply with quote

I have a requirement to subtract the value, in position 19, for record type 800 from the value, in position 19, for record type 300, if record type 800 exists (record type 300 WILL ALWAYS exist).

Input:
Code:
003002024-11-30    900
008002024-11-30    800
002002024-12-02    300
005002024-11-30    400
006002024-11-30    500
003002025-01-31   1000
008002025-01-31    800
002002025-02-03    250
005002025-01-31      1
006002025-01-31     10
002002025-01-03    200
003002024-10-31    350
002002024-11-01    400
005002024-10-31      9
006002024-10-31     10


Output:
Code:
003002024-11-30    100
008002024-11-30    800
002002024-12-02    300
005002024-11-30    400
006002024-11-30    500
003002025-01-31    200
008002025-01-31    800
002002025-02-03    250
005002025-01-31      1
006002025-01-31     10
002002025-01-03    200
003002024-10-31    350
002002024-11-01    400
005002024-10-31      9
006002024-10-31     10


I tried PUSH but didn't get the expected results (above).

My code is
Code:

//SYSIN    DD *                                                   
 SORT FIELDS=(1,5,A,6,10,A),FORMAT=CH                           
 OUTFIL REMOVECC, NODETAIL                                           
 SECTIONS=(1,5,6,10,TRAILER3=(1,5,2X,6,10,2X,TOT=(19,5,PD,M12,
 LENGTH=13)))                                                     
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,ZD,EQ,800),                 
        PUSH=(42:1,20)),                                         
  IFTHEN=(WHEN=(1,5,ZD,EQ,300,AND,6,10,CH,EQ,47,10,CH),         
    OVERLAY=(60:57,5,PD,SUB,19,5,PD,EDIT=(III,III,III)))         
/*                                                               


Any assistance would be greatly appreciated.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Thu Feb 27, 2025 7:48 am
Reply with quote

Sample
Code:
//WHATEVER EXEC PGM=SORT                                 
//SYMNOUT  DD SYSOUT=*                                   
//F1       DD *                                         
003002024-11-30    900                                   
008002024-11-30    800                                   
002002024-12-02    300                                   
005002024-11-30    400                                   
006002024-11-30    500                                   
003002025-01-31   1000                                   
008002025-01-31    800                                   
002002025-02-03    250                                   
005002025-01-31      1                                   
006002025-01-31     10                                   
002002025-01-03    200                                   
003002024-10-31    350                                   
002002024-11-01    400                                   
005002024-10-31      9                                   
006002024-10-31     10                                   
/*                                                       
//F2       DD DUMMY,RECFM=FB,LRECL=80                   
//SYSOUT   DD SYSOUT=*                                   
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  JOINKEYS F1=F1,FIELDS=(81,8,D)                         
  JOINKEYS F2=F2,FIELDS=(1,8,D),SORTED,NOSEQCK           
  JOIN UNPAIRED,F1,ONLY                                 
  INREC IFTHEN=(WHEN=GROUP,                             
    BEGIN=(1,5,CH,EQ,C'00800'),END=(1,5,CH,EQ,C'00300'),
    PUSH=(30:19,4)),                                     
    IFTHEN=(WHEN=(1,5,CH,EQ,C'00300'),                   
      OVERLAY=(19:19,4,ZD,SUB,30,4,ZD,M10,LENGTH=4))     
  SORT FIELDS=(81,8,ZD,A)                               
  OUTFIL FNAMES=(SORTOUT),                               
    REMOVECC,                                           
    BUILD=(1,22)                                         
  END                                                   
/*                                                       
//JNF1CNTL DD *                 
  INREC OVERLAY=(81:SEQNUM,8,ZD)
  END                           
/*                               
//JNF2CNTL DD *                 
  END                           
/*

Op
Code:
****** *************************
000001 003002024-11-30    100   
000002 008002024-11-30    800   
000003 002002024-12-02    300   
000004 005002024-11-30    400   
000005 006002024-11-30    500   
000006 003002025-01-31    200   
000007 008002025-01-31    800   
000008 002002025-02-03    250   
000009 005002025-01-31      1   
000010 006002025-01-31     10   
000011 002002025-01-03    200   
000012 003002024-10-31    350   
000013 002002024-11-01    400   
000014 005002024-10-31      9   
000015 006002024-10-31     10   
****** *************************
Back to top
View user's profile Send private message
chillmo

New User


Joined: 31 Aug 2017
Posts: 54
Location: USA

PostPosted: Thu Feb 27, 2025 11:10 am
Reply with quote

It worked perfectly!

Joerg.Findeisen, you're one of the best!
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Thu Feb 27, 2025 11:35 am
Reply with quote

I have decided not to sort by date and key, that's why there are sequence numbers added instead. If it's more understandable, you can split the step into two, or use SYNCTOOL. Whatever is better for you.
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. Need assistance in job scheduling logic. Mainframe Interview Questions 2
No new posts Icetool - Using PUSH DFSORT/ICETOOL 1
No new posts Need assistance formatting when joini... SYNCSORT 8
No new posts need assistance on a sort SYNCSORT 11
This topic is locked: you cannot edit posts or make replies. Get value from 2nd record and PUSH it... JCL & VSAM 1
Search our Forums:


Back to Top