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
 

 

Join key - Populate Zeros when Unpaired from File 1

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rexx77

New User


Joined: 14 Apr 2008
Posts: 73
Location: Mysore

PostPosted: Thu May 12, 2016 12:22 am    Post subject: Join key - Populate Zeros when Unpaired from File 1
Reply with quote

I am using Join keys to for the below example.

File 1:

Code:
AAA 10000
BBB 11000


File 2:
Code:
AAA 20000 000
CCC 21000 000


Expected output:
Code:
AAA         10000              20000
BBB         11000                      0


my sort join card is something like below

Code:
JOINKEYS FILE=F1,FIELDS=(1,3,A)
JOINKEYS FILE=F2,FIELDS=(1,3,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,9,F2:5,5),FILL=X'00'
SORT FIELDS=COPY


Output:
The output file has Zeroes when unpaired F1 exists. But it is being displayed like when I see it with copybook layout. It is missing sign, as module is reading the value into COMP-3 field. How to populate Zeroes for unpaired F1 records.

Code:
 X'000000000000'


It should have been
Code:
 0
.

Appreciate your help on this

Code'd
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Thu May 12, 2016 12:50 am    Post subject: Reply to: Join key - Populate Zeros when Unpaired from File 1
Reply with quote

Perhaps you can use 'Overlay' like this:
Code:
 JOINKEYS FILE=F1,FIELDS=(1,3,A)
 JOINKEYS FILE=F2,FIELDS=(1,3,A)
 JOIN UNPAIRED,F1
 REFORMAT FIELDS=(F1:1,9,F2:5,5),FILL=X'FF'
 OUTFIL IFTHEN=(WHEN=(10,5,CH,EQ,X'FFFFFFFFFF'),
 OVERLAY=(10:X'000000000C'))
 SORT FIELDS=COPY   

.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu May 12, 2016 2:18 am    Post subject: Reply to: Join key - Populate Zeros when Unpaired from File 1
Reply with quote

RahulG31,

I should have coded before fixing the typos on your post :-)

rexx77,

Please use the Code-tags to preserve spacing.

Look at the use of the match-marker (a ? in the REFORMAT, which is replaced with the result of the join, B for both (a match), 1 for a mismatched file1, 2 for a mismatched file 2).

Use INREC, you need a BUILD to turn the REFORMAT record into the expected output, then an OVERLAY (and use IFOUTLEN to cut the record down) or a conditional BUILD with a second BUILD on WHEN=NONE - one BUILD doing a packed-zero, the other doing the actual value from the REFORMAT record.
Back to top
View user's profile Send private message
rexx77

New User


Joined: 14 Apr 2008
Posts: 73
Location: Mysore

PostPosted: Thu May 12, 2016 2:30 am    Post subject:
Reply with quote

Thanks Rahul for the solution. This will work.

My fellow colleague gave me below logic, this also worked.

Code:

JOINKEYS FILE=F1,FIELDS=(1,3,A)
 JOINKEYS FILE=F2,FIELDS=(1,3,A)
 JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,9,F2:5,5),FILL=C'X'
INREC IFTHEN=(WHEN=(10,1,CH,EQ,C'X'),
      BUILD=(1,9,5Z,X'0C')),
      IFTHEN=(WHEN=(10,1,CH,NE,C'X'),
      BUILD=(1,14))


Thanks folks.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Thu May 12, 2016 2:35 am    Post subject:
Reply with quote

Or this may be as per Bill's direction.
Code:
REFORMAT FIELDS=(F1:1,9,F2:5,5,?)                   
SORT FIELDS=COPY                                   
OUTFIL IFTHEN=(WHEN=(15,1,CH,EQ,C'B'),BUILD=(1,14)),
       IFTHEN=(WHEN=(15,1,CH,EQ,C'1'),             
               BUILD=(1,9,4Z,+0,TO=PD,LENGTH=1))       

you are missing a option copy icon_smile.gif
Back to top
View user's profile Send private message
rexx77

New User


Joined: 14 Apr 2008
Posts: 73
Location: Mysore

PostPosted: Thu May 12, 2016 3:12 am    Post subject:
Reply with quote

It was copy paste mistake. COPY option was missed while posting.. Thanks Rohit.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu May 12, 2016 3:25 am    Post subject: Reply to: Join key - Populate Zeros when Unpaired from File 1
Reply with quote

And in a topic for typos, the 5Z should be 4Z since the fifth byte gets appended.
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 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
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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