Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Conditional reformatting the output file with JOINKEY

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Conditional reformatting the output file with JOINKEY
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7308

PostPosted: Sat Apr 07, 2012 1:24 pm    Post subject: Reply to: Conditional reformatting the output file with JOIN
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us