IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Replace values in the input data


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vikas Maharnawar

New User


Joined: 19 Apr 2017
Posts: 6
Location: india

PostPosted: Thu May 11, 2017 2:18 pm
Reply with quote

Hi
I have Two input files

Input File 1
Code:
 AAA BBB CCC DDDD
PPP PPP QQQ SSSS
EEE FFF GGG HHHH
KKK LLL MMM NNNN
SSS TTT SSS JJJJ
FLD(7,2) == '03',
FLD(7,2) == '04',
FLD(7,2) == '05',
FLD(7,2) == '06',
FLD(7,2) == '07',
XYZ XYX XXX     
PQR MNO         


Input file 2
Code:
12
13
14
15
16


Output file
Code:
AAA BBB CCC DDDD
PPP PPP QQQ SSSS
EEE FFF GGG HHHH
KKK LLL MMM NNNN
SSS TTT SSS JJJJ
FLD(7,2) == '12',
FLD(7,2) == '13',
FLD(7,2) == '14',
FLD(7,2) == '15',
FLD(7,2) == '16',
XYZ XYX XXX     
PQR MNO         

I want to replace records using JCL . kindly help me to get expected output.
Thanks in advance!!!
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu May 11, 2017 3:00 pm
Reply with quote

show us what You have done to help Yourself,

a forum is for help...
no for just dropping a problem and asking for a solution
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu May 11, 2017 3:02 pm
Reply with quote

Well, you may want to use JCL and I do not see what problem you are having as the JCL required to run DFsort is explained in the DFsort manual. But JCL by itself cannot do what you want - you need utility, in this case DFsort, control statements. So what have you tried so far (you are in the expert's forum not the Beginners so you should have tried something)?

Please use the code tags when posting code and data and note that on the mainframe data is held in data sets not files.
(I was going to edit your posgt to make it use the code tags but I see that Enrico got there first!)
Back to top
View user's profile Send private message
Vikas Maharnawar

New User


Joined: 19 Apr 2017
Posts: 6
Location: india

PostPosted: Thu May 11, 2017 3:18 pm
Reply with quote

I written below JCl

Code:
//STEP01   EXEC  PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN1      DD DSN=XYZ,DISP=SHR                             
//IN2      DD DSN=PQR,DISP=SHR                           
//TEMP     DD DSN=&&TEMP,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT      DD DSN=ABC,DISP=(NEW,CATLG,DELETE),                           
//           DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),                   
//           UNIT=3390,SPACE=(TRK,(10,10),RLSE)                     
//TOOLIN   DD *                                                       
 COPY FROM(IN1) TO(TEMP) USING(CTL1)                                 
 COPY FROM(IN2) TO(TEMP) USING(CTL2)                                 
 SPLICE FROM(TEMP) TO(OUT) ON(81,2,ZD) WITH(14,02) USING(CTL3)       
//CTL1CNTL DD *                                                       
 INREC BUILD=(1,17,81:SEQNUM,2,ZD)                                   
/*                                                                   
//CTL2CNTL DD *                                                       
 INREC BUILD=(14:1,02,81:SEQNUM,2,ZD)                                 
/*                                                                   
//CTL3CNTL DD *                                                       
 OUTFIL FNAMES=OUT,BUILD=(1,80)
 /*                   

Job gives below Output to me
Code:
AAA BBB CCC D12D
PPP PPP QQQ S13S
EEE FFF GGG H14H
KKK LLL MMM N15N
SSS TTT SSS J16J


Coded - again
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu May 11, 2017 3:49 pm
Reply with quote

3 things:

1 - learn to use the code tags - use the full reply editor not the quick reply.
2 - the experts will probably say that you should use JOINKEYS - look in the forum for various examples.
3 - you probably should not provide DCB info on your output DD name.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu May 11, 2017 8:12 pm
Reply with quote

Are the contents of your input-1 static?
Will there be the same number of records in input-1, each time?
Will there be the same number of records in input-2, each time?

Like Nic pointed out, you might be able to achieve this without SPLICEing.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Thu May 11, 2017 10:24 pm
Reply with quote

With the given input, this will work.
Code:

----+----1----+----2----+
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//INA      DD *         
AAA BBB CCC DDDD         
PPP PPP QQQ SSSS         
EEE FFF GGG HHHH         
KKK LLL MMM NNNN         
SSS TTT SSS JJJJ         
FLD(7,2) == '03',       
FLD(7,2) == '04',       
FLD(7,2) == '05',       
FLD(7,2) == '06',       
FLD(7,2) == '07',       
XYZ XYX XXX             
PQR MNO                 
//INB      DD *         
12                       
13                       
14                       
15                       
16                       
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  JOINKEYS F1=INA,FIELDS=(25,2,A),SORTED,NOSEQCK                   
  JOINKEYS F2=INB,FIELDS=(25,2,A),SORTED,NOSEQCK                     
  JOIN UNPAIRED,F1                                   
  REFORMAT FIELDS=(F1:1,20,F2:1,2,?)                 
  OUTREC IFOUTLEN=20,                                 
  IFTHEN=(WHEN=(14,2,CH,EQ,C'03'),OVERLAY=(14:21,2)),
  IFTHEN=(WHEN=(14,2,CH,EQ,C'04'),OVERLAY=(14:21,2)),
  IFTHEN=(WHEN=(14,2,CH,EQ,C'05'),OVERLAY=(14:21,2)),
  IFTHEN=(WHEN=(14,2,CH,EQ,C'06'),OVERLAY=(14:21,2)),
  IFTHEN=(WHEN=(14,2,CH,EQ,C'07'),OVERLAY=(14:21,2)) 
//JNF1CNTL DD *                                       
  INREC OVERLAY=(25:SEQNUM,2,ZD)                     
//JNF2CNTL DD *                                       
  INREC OVERLAY=(25:SEQNUM,2,ZD,START=6,INCR=1)       
//*     
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri May 12, 2017 1:13 am
Reply with quote

Rohit,

I modified your card a little so that the result is not dependent on input values, rather on some input key (in this case position 1-3 = FLD).

Code:
//SYSIN DD *
  SORT FIELDS=COPY
  JOINKEYS F1=INA,FIELDS=(25,2,A),SORTED,NOSEQCK
  JOINKEYS F2=INB,FIELDS=(25,2,A),SORTED,NOSEQCK
  JOIN UNPAIRED,F1
  REFORMAT FIELDS=(F1:1,20,F2:1,2,?)
  OUTREC IFOUTLEN=20,
  IFTHEN=(WHEN=(1,3,CH,EQ,C'FLD'),OVERLAY(14:21,2))
//JNF1CNTL DD *
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'FLD'),OVERLAY=(25:SEQNUM,2,ZD))
/*
//JNF2CNTL DD *
  INREC OVERLAY=(25:SEQNUM,2,ZD)
/*
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Fri May 12, 2017 12:51 pm
Reply with quote

RahulG31, much better way of doing it. Thanks.
Back to top
View user's profile Send private message
Vikas Maharnawar

New User


Joined: 19 Apr 2017
Posts: 6
Location: india

PostPosted: Fri May 12, 2017 3:27 pm
Reply with quote

It works successfully.
Thank you all of you for giving your valuable time and helping me. icon_smile.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Sat May 13, 2017 3:04 am
Reply with quote

Welcome here!.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top