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: 74
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: 378
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: 7315

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: 74
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: 1737
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: 74
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: 7315

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 Extra character appears in file when ... Balu5491 All Other Mainframe Topics 0 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm


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