MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Updating a field in file by checking in the other file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Thu Feb 14, 2008 9:13 am    Post subject: Updating a field in file by checking in the other file Reply with quote

Hi,

I have a file with Record format as FB and Record length as 304 which is used as an input file.
If the first two charcters in this file are "1D" I have to extract 4 charcters starting from position 14.
If the first two charcters in this file are "1H" I have to extract 4 charcters starting from position 16.
I have one more file with Record format as FB and Record length as 131 which is used as INPUT&OUTPUT file.

The extracted charcaters from the first file should be updated in the second file starting from position 39.

First file:
Code:

1H01999001     5692A5L66AEZBL       7781A1
1H01999001     5692A5L66AE0BL  00001001641A
1D016535DAF  9406MESLQ95W4
1D016535DAF  9406MESLQ95W4
1D016535DAF  9406MESLQ95W4
1D016535DAF  9406MESLQ95W4


Second file:
Code:
78300000970123C08020777802FCU411A2    00000
78300000970123C08020777802FCU411A2    00000
78300000970123C08020777802FCU411A2    00000
78300000970123C08020777802FCU411A2    00000
78300000970123C08020777802FCU411A2    00000
78300000970123C08020777802FCU411A2    00000


I want the second file to be updated like below.
Code:
78300000970123C08020777802FCU411A2    5692
78300000970123C08020777802FCU411A2    5692
78300000970123C08020777802FCU411A2    9406
78300000970123C08020777802FCU411A2    9406
78300000970123C08020777802FCU411A2    9406
78300000970123C08020777802FCU411A2    9406

I created the below job but it is not giving the output as I expect.
Code:
//STEP01   EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN1      DD DSN=RIVOP010.CPS.MAL.IDDEREC.G0313V00,DISP=SHR   
//IN2      DD DSN=RIVOPA3.CPS.MAL.IDDTEMPA.P,DISP=OLD         
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(10,10),RLSE)
//TOOLIN   DD *                                               
  COPY FROM(IN1) TO(T1) USING(CPY1)                           
  COPY FROM(IN2) TO(T1) USING(CPY2)                           
  COPY FROM(T1) TO(IN2)                                       
//CPY1CNTL DD *                                               
  INCLUDE COND=(1,2,CH,EQ,C'1D')                               
  OUTREC FIELDS=(1:38X,39:14,4,43:262X)                       
  INCLUDE COND=(1,2,CH,EQ,C'1H')                               
  OUTREC FIELDS=(1:38X,39:16,4,43:262X)                       
/*                                                             
//CPY2CNTL DD *                                               
  OUTREC FIELDS=(1:1,38,43:43,88)                             
/*                                                             
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Feb 14, 2008 12:06 pm    Post subject: Reply with quote

I don't really know what your job is supposed to do. The syntax is wrong (you have duplicate INCLUDE and OUTREC statements in CPY1CNTL) and it doesn't do a SPLICE.

At any rate, assuming that you want to overlay the constant from the first record of file1 into the first record of file2, the second record of file1 into the second record of file2, etc, you can use this DFSORT/ICETOOL job to do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1  (FB/304)
//IN2 DD DSN=...  input file2  (FB/131)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/131)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(132,8,ZD) WITH(39,5) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(132:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(132:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(1,2,CH,EQ,C'1H'),BUILD=(39:16,4,132:132,8)),
    IFTHEN=(WHEN=(1,2,CH,EQ,C'1D'),BUILD=(39:14,4,132:132,8))
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,BUILD=(1,131)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Fri Feb 15, 2008 12:47 am    Post subject: Reply with quote

Frank,

Thanks for your reply. Your code is not overriding the 4 characters in the output starting from position 39 by taking the 4 characters from either positions 14 or 16 depending on 1D or 1H.
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Feb 15, 2008 12:10 pm    Post subject: Reply with quote

When I run my job with data like you described, it certainly does do what you asked for.

So if the job is not working for you, either the data doesn't look like what you said it does, or you changed my job in some way, or your site has changed the default options in some way that makes a difference.

Saying it doesn't work without any other information isn't helpful. Send me the following offline (yaeger@us.ibm.com) and I'll take a look:

Your complete JCL and control statements.

The complete set of TOOLMSG and DFSMSG messages you received when you ran the job.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group