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

Conditional reformatting the output file with JOINKEY


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Sat Apr 07, 2012 12:10 pm
Reply with quote

This is my requirement:

1st file:
Code:

---------1
A1XXXAXXX
A2XXXBXXX
A3XXXCXXX
A4XXXDXXX


2nd file:
Code:

---------1
A1XXXXYT
A2XXXX U
A3XXXXNV



Expected o/p:
Code:

---------1
A1XXXYXXXT
A2XXXNXXXU
A3XXXNXXXV
A4XXXNXXX


Key is 1,2
all files are FB

1. All records from file1 should be there in o/p file.
2. If file2(7,1)=Y then o/p file(6,1)=Y else N (even if matching record not found)
3. o/p file(10,1) should contain value from file2(8,1). If no matching record then space in o/p file.


There is a COBOL program written for this, but since the actual files LRCL and record volume is very high, I need to test with SORT to see if some CPU is saved.

Thanks in advance for your guidance.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Apr 07, 2012 1:24 pm
Reply with quote

This should give you something to start on.

Code:
//JOINRCOB EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(01,2,A),SORTED,NOSEQCK
  JOINKEYS F2=IN2,FIELDS=(01,2,A),SORTED,NOSEQCK
  JOIN UNPAIRED,F1
  REFORMAT FIELDS=(F1:1,9,F2:7,2,?)
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
               OVERLAY=(13:C'N ')),
        IFTHEN=(WHEN=(12,1,CH,EQ,C'B',
                  AND,10,1,CH,EQ,C'Y'),
                OVERLAY=(13:10,1),HIT=NEXT),
        IFTHEN=(WHEN=(12,1,CH,EQ,C'B'),
                OVERLAY=(14:11,1))
  OUTREC BUILD=(1,5,13,1,7,2,14,1)
//IN1 DD *
A1XXXAXXX
A2XXXBXXX
A3XXXCXXX
A4XXXDXXX
//IN2 DD *
A1XXXXYT
A2XXXX U
A3XXXXNV


Output is:

Code:
A1XXXYXXT
A2XXXNXXU
A3XXXNXXV
A4XXXNXX
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Mon Apr 09, 2012 9:10 pm
Reply with quote

Thanks Bill...
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top