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
 

 

Replace 4 digit code to 3 digit code if lookup present

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

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Jan 28, 2011 12:49 pm    Post subject: Replace 4 digit code to 3 digit code if lookup present
Reply with quote

Hi All...

Here is my requirement..

I have two reference files..

1: Supplier file
RECFM FB, LRECL 10
Supplier code first is 5 byte remaining are spaces
Code:

ABC
DEF
GHI
JKL
MNO


Second reference is 3 digit to 4 digit reference file.

RECFM=FB, LRECL 7
First 3 bytes old code
Next 4 bytes new code
Code:

1111111
1122111
1133111
1155123


Actual input file is as below:
RECFM=FB,LRECL=80
Code:

CNTLABC
SEGA
SEGB
SEGC
SEGD5123
SEGE
CNTLPQR
SEGA
SEGB
SEGC
SEGD5123
SEGE

CNTL segment identifies supplier, if this supplier is present in first supplier reference file then whatever 4 digit code present in segment SEGD should be replaced with corresponding 3 digit code from reference file followed by one SPACE.
Expected output:
Code:

CNTLABC
SEGA
SEGB
SEGC
SEGD115
SEGE
CNTLPQR
SEGA
SEGB
SEGC
SEGD5123
SEGE

since first supplier ABC was present in supplier ref file 4 digit code in SEGD segment is replaced with 3 digit code using file2.
since PQR supplier is not present in the supplier ref file 4 digit code in SEGD is kept as it is.
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Jan 28, 2011 8:32 pm    Post subject:
Reply with quote

I have DFSORT\ICETOOL on my shop
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jan 28, 2011 11:26 pm    Post subject:
Reply with quote

escapa,

You need two Joinkey steps to perform the match. Here is a DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//INA      DD DSN=Your actual 80 byte input file,DISP=SHR
//INB      DD DSN=Your supplier 10 byte file,DISP=SHR                   
//SORTOUT  DD DSN=&&TEMP,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)           
//SYSIN    DD *                                                         
  OPTION COPY                                                           
  JOINKEYS F1=INA,FIELDS=(81,5,A)                                       
  JOINKEYS F2=INB,FIELDS=(01,5,A)                                       
  JOIN UNPAIRED,F1                                                     
  REFORMAT FIELDS=(F1:1,93,?)                                           
  OUTFIL IFTHEN=(WHEN=(94,1,CH,EQ,C'B',AND,1,4,CH,EQ,C'SEGD'),         
  OVERLAY=(94:5,4)),                                                   
  IFTHEN=(WHEN=NONE,OVERLAY=(94:4X))                                   
//JNF1CNTL DD *                                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'CNTL'),                   
  PUSH=(81:5,5,SEQ=8))                                                 
//*                                                 
//STEP0200 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//INA      DD DSN=&&TEMP,DISP=SHR                                     
//INB      DD DSN=Your referencer 7 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  JOINKEYS F1=INA,FIELDS=(94,4,A)                                     
  JOINKEYS F2=INB,FIELDS=(04,4,A)                                     
  JOIN UNPAIRED,F1                                                     
  REFORMAT FIELDS=(F1:1,93,?,F2:1,3)                                   
  SORT FIELDS=(81,13,CH,A),EQUALS                                     
  OUTREC IFOUTLEN=80,IFTHEN=(WHEN=(94,1,CH,EQ,C'B'),OVERLAY=(5:95,3,X))
//*
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 Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 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 Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


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