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
 

 

Need to update a recognition indicator value in the i/p file

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

New User


Joined: 24 Nov 2005
Posts: 49
Location: chennai

PostPosted: Mon Jun 04, 2012 11:32 am    Post subject: Need to update a recognition indicator value in the i/p file
Reply with quote

Hi,

We have 2 Input files,

I/P 1:

AAA1NO27A1727045ASELECTHOTN
AAA1NO27A1727045BSELECTHOTN
BBB2DO27A1727045ASELECTHOTN
BBB2DO27A1727045BSELECTHOTN
CCC3NO27A1727045ASELECTHOTN
CCC3NO27A1727045BSELECTHOTN
AAA1NO27B1727045ASELECTHOTN
AAA1NO27B1727045BSELECTHOTN
BBB2DO27B1727045ASELECTHOTN
BBB2DO27B1727045BSELECTHOTN
CCC3NO27B1727045ASELECTHOTN
CCC3NO27B1727045BSELECTHOTN


I/P 2:

AAA1NO45AY
BBB2DO45AY
CCC3NO45AY

Have to update the last byte as "Y" for the first file based on the matching id with the second file. Also the non matching records should be written to the output.

Match id criteria:file 1 key--> 1 to 6 & 15 to 17 combined togerther as key.
file2 key--> 1 to 6 & 7 to 9 positions.


Expected output:

AAA1NO27A1727045ASELECTHOTYAAA1NO27A1727045BSELECTHOTN
BBB2DO27A1727045ASELECTHOTYBBB2DO27A1727045BSELECTHOTN
CCC3NO27A1727045ASELECTHOTYCCC3NO27A1727045BSELECTHOTN
AAA1NO27B1727045ASELECTHOTYAAA1NO27B1727045BSELECTHOTN
BBB2DO27B1727045ASELECTHOTYBBB2DO27B1727045BSELECTHOTN
CCC3NO27B1727045ASELECTHOTYCCC3NO27B1727045BSELECTHOTN
Back to top
View user's profile Send private message

akashs

New User


Joined: 24 Nov 2005
Posts: 49
Location: chennai

PostPosted: Mon Jun 04, 2012 11:36 am    Post subject:
Reply with quote

Hi,

We have 2 Input files,

I/P 1:

AAA1NO27A1727045ASELECTHOTN
AAA1NO27A1727045BSELECTHOTN
BBB2DO27A1727045ASELECTHOTN
BBB2DO27A1727045BSELECTHOTN
CCC3NO27A1727045ASELECTHOTN
CCC3NO27A1727045BSELECTHOTN
AAA1NO27B1727045ASELECTHOTN
AAA1NO27B1727045BSELECTHOTN
BBB2DO27B1727045ASELECTHOTN
BBB2DO27B1727045BSELECTHOTN
CCC3NO27B1727045ASELECTHOTN
CCC3NO27B1727045BSELECTHOTN


I/P 2:

AAA1NO45AY
BBB2DO45AY
CCC3NO45AY

Have to update the last byte as "Y" for the first file based on the matching id with the second file. Also the non matching records should be written to the output.

Match id criteria:file 1 key--> 1 to 6 & 15 to 17 combined togerther as key.
file2 key--> 1 to 6 & 7 to 9 positions.


Expected output:


AAA1NO27A1727045ASELECTHOTY
AAA1NO27A1727045BSELECTHOTN
BBB2DO27A1727045ASELECTHOTY
BBB2DO27A1727045BSELECTHOTN
CCC3NO27A1727045ASELECTHOTY
CCC3NO27A1727045BSELECTHOTN
AAA1NO27B1727045ASELECTHOTY
AAA1NO27B1727045BSELECTHOTN
BBB2DO27B1727045ASELECTHOTY
BBB2DO27B1727045BSELECTHOTN
CCC3NO27B1727045ASELECTHOTY
CCC3NO27B1727045BSELECTHOTN



Thanks,
Akash
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1534
Location: Andromeda Galaxy

PostPosted: Mon Jun 04, 2012 1:53 pm    Post subject:
Reply with quote

This might help

Code:

//SRTJK EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//JNA DD *
AAA1NO27A1727045ASELECTHOTN
AAA1NO27A1727045BSELECTHOTN
BBB2DO27A1727045ASELECTHOTN
BBB2DO27A1727045BSELECTHOTN
CCC3NO27A1727045ASELECTHOTN
CCC3NO27A1727045BSELECTHOTN
AAA1NO27B1727045ASELECTHOTN
AAA1NO27B1727045BSELECTHOTN
BBB2DO27B1727045ASELECTHOTN
BBB2DO27B1727045BSELECTHOTN
CCC3NO27B1727045ASELECTHOTN
CCC3NO27B1727045BSELECTHOTN
//JNB DD *
AAA1NO45AY
BBB2DO45AY
CCC3NO45AY
//OUT DD SYSOUT=*
//TOOLIN DD *
 SORT JKFROM TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
  JOINKEYS F1=JNA,FIELDS=(1,6,A,15,3,A)
  JOINKEYS F2=JNB,FIELDS=(1,6,A,7,3,A)
  JOIN UNPAIRED,F1,F2
  REFORMAT FIELDS=(F1:1,27,F2:1,10)
  OPTION EQUALS
  SORT FIELDS=(7,3,CH,A)
  INREC IFTHEN=(WHEN=(28,10,CH,EQ,C'          '),
         BUILD=(1:1,27)),
        IFTHEN=(WHEN=(28,10,CH,NE,C'          '),
         BUILD=(1:1,26,C'Y'))
/*
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Jun 04, 2012 8:14 pm    Post subject:
Reply with quote

akashs,
Assuming your input file1 is 80 byte/FB and that you want matched records in their original input sequence, see if below works... Unmatched records are written to DD UNMATCH.
Code:
//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//INA      DD INPUT FILE1 --> ASSUMED 80/FB                   
//INB      DD INPUT FILE2 --> ASSUMED FB                                     
//MATCHED  DD SYSOUT=*                                         
//UNMATCH  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  JOINKEYS F1=INA,FIELDS=(01,06,A,15,03,A)                     
  JOINKEYS F2=INB,FIELDS=(01,06,A,07,03,A)                     
  JOIN UNPAIRED,F1                                             
  REFORMAT FIELDS=(F1:1,88,?)                                 
  INREC IFTHEN=(WHEN=(89,1,CH,EQ,C'B'),OVERLAY=(27:C'Y'))     
  SORT FIELDS=(81,8,ZD,A),EQUALS                               
  OUTFIL FNAMES=MATCHED,BUILD=(1,80)                           
  OUTFIL FNAMES=UNMATCH,INCLUDE=(89,1,CH,EQ,C'1'),BUILD=(1,80)
//*                                                           
//JNF1CNTL DD *                                               
 INREC OVERLAY=(81:SEQNUM,8,ZD)                               
/*                                                             


Pandora-Box,
Not sure why you have used JKFROM using ICETOOL when you can achieve the same using SORT step only. Also read about JOIN Indicator(?) in the REFORMAT statement.

Thanks,
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1534
Location: Andromeda Galaxy

PostPosted: Mon Jun 04, 2012 8:37 pm    Post subject:
Reply with quote

Thanks SQLCODE icon_smile.gif ( This sort wasnt working for me sometime back so I used ICETOOL)

I slightly modified the code if TS needs output in one file

Code:

//INA DD *
AAA1NO27A1727045ASELECTHOTN
AAA1NO27A1727045BSELECTHOTN
BBB2DO27A1727045ASELECTHOTN
BBB2DO27A1727045BSELECTHOTN
CCC3NO27A1727045ASELECTHOTN
CCC3NO27A1727045BSELECTHOTN
AAA1NO27B1727045ASELECTHOTN
AAA1NO27B1727045BSELECTHOTN
BBB2DO27B1727045ASELECTHOTN
BBB2DO27B1727045BSELECTHOTN
CCC3NO27B1727045ASELECTHOTN
CCC3NO27B1727045BSELECTHOTN
//INB DD *
AAA1NO45AY
BBB2DO45AY
CCC3NO45AY
//MATCHED  DD SYSOUT=*
//UNMATCH  DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  JOINKEYS F1=INA,FIELDS=(01,06,A,15,03,A)
  JOINKEYS F2=INB,FIELDS=(01,06,A,07,03,A)
  JOIN UNPAIRED,F1
  REFORMAT FIELDS=(F1:1,88,?)
  INREC IFTHEN=(WHEN=(89,1,CH,EQ,C'B'),OVERLAY=(27:C'Y'))
  SORT FIELDS=(81,8,ZD,A),EQUALS
  OUTREC FIELDS=(1:1,80)
//*
//JNF1CNTL DD *
 INREC OVERLAY=(81:SEQNUM,8,ZD)
/*
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Jun 04, 2012 8:51 pm    Post subject:
Reply with quote

Pandora-Box,
Quote:
Thanks SQLCODE ( This sort wasnt working for me sometime back so I used ICETOOL)

And JOINKEYS using ICETOOL worked? icon_question.gif icon_question.gif icon_question.gif

Quote:
I slightly modified the code if TS needs output in one file

I provided 2 separate files because I wasn't sure if OP wanted UNMATCH in a separate file. OP is getting what he asked for in the matched file.

Thanks,
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1534
Location: Andromeda Galaxy

PostPosted: Mon Jun 04, 2012 8:55 pm    Post subject:
Reply with quote

sqlcode1 wrote:
Pandora-Box,
Quote:
Thanks SQLCODE ( This sort wasnt working for me sometime back so I used ICETOOL)

And JOINKEYS using ICETOOL worked? icon_question.gif icon_question.gif icon_question.gif

Quote:
I slightly modified the code if TS needs output in one file

I provided 2 separate files because I wasn't sure if OP wanted UNMATCH in a separate file. OP is getting what he asked for in the matched file.

Thanks,


Yes that was long time back though I might have made mistkaes in the syntax but a year back I was using V1R5 now V1R10 so extra commands icon_smile.gif

Anyway let OP decide the solution which might suit his needs
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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