Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 7315

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 Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us