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: 7251

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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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