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
 
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: 78
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: 408
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: 7314

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: 78
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: 1818
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: 78
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: 7314

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 VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
No new posts Updating data from one file to other!!! Vignesh Sid SYNCSORT 1 Mon Nov 06, 2017 2:42 pm
This topic is locked: you cannot edit posts or make replies. Need help how to pass the ESP variabl... Venkichaitu JCL & VSAM 12 Thu Nov 02, 2017 3:53 am
This topic is locked: you cannot edit posts or make replies. Comparing current time with the time ... arunsoods SYNCSORT 1 Mon Oct 30, 2017 4:07 pm

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