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

Insert a particular value in all the records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Fri Jul 20, 2007 12:15 pm
Reply with quote

Hi All,

I have a requirement as below.

I/P file contains 100 records. I want to insert a value between 10 to 20 bytes in first record to all the remaining records (99) between 70 to 80. My file has Basically of 150 bytes. Basically whatever the value is there B/W 10-20 positions in first record to be inserted into all the records.

Please let me know how to this efficiently.

Thanks in advance,
Chinni.
Back to top
View user's profile Send private message
ratheesh_1983

New User


Joined: 11 Apr 2007
Posts: 19
Location: hyderabad

PostPosted: Fri Jul 20, 2007 2:00 pm
Reply with quote

oh chinni i cud n't get more confused!!!
icon_eek.gif


ratheesh
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Fri Jul 20, 2007 2:23 pm
Reply with quote

Hi,

Please show your input file & the expected output to get better responses.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Jul 20, 2007 5:47 pm
Reply with quote

chinnielr
Do you want the first record also in the o/p?
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Jul 20, 2007 5:54 pm
Reply with quote

chinnielr
Assuming you also need the 1st line in your o/p, this is the solution:
Code:
//S1       EXEC  PGM=ICEMAN                                             
//SYSOUT   DD  SYSOUT=*                                                 
//SORTIN   DD *                                                         
/*                                                                     
//SORTOUT  DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)       
//SYSIN    DD    *                                                     
  SORT FIELDS=COPY,STOPAFT=1                                           
   INREC BUILD=(C'DATA1,''',11,9,C'''',80:X)                           
/*                                                                     
//S2       EXEC  PGM=ICEMAN                                             
//SYSOUT   DD  SYSOUT=*                                                 
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)                                 
//SORTIN   DD *                                                         
/*                                                                     
//OUT      DD SYSOUT=*                                                 
//SYSIN    DD    *                                                     
  OPTION COPY                                                           
  INREC  BUILD=(1,150,151:SEQNUM,4,ZD)                                 
  OUTFIL FNAMES=OUT,IFTHEN=(WHEN=(151,4,ZD,NE,+0001),                   
                    BUILD=(1,70,DATA1,80,70))                           
/*                                                                     
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 20, 2007 8:57 pm
Reply with quote

Chinni,

krisprems is on the right track, but I think he has the positions of the fields wrong. Here's a DFSORT job that will do what you asked for:

Code:

//S1       EXEC  PGM=ICEMAN
//SYSOUT   DD  SYSOUT=*
//SORTIN   DD DSN=...  input file (FB/150)
//SORTOUT  DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
   OPTION COPY,STOPAFT=1
   INREC BUILD=(C'DATA1,''',10,11,C'''',80:X)
/*
//S2       EXEC  PGM=ICEMAN
//SYSOUT   DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN   DD DSN=...  input file (FB/150)
//SORTOUT  DD DSN=...  output file (FB/150)
//SYSIN    DD    *
  OPTION COPY
  INREC  IFOUTLEN=150,
         IFTHEN=(WHEN=INIT,OVERLAY=(151:SEQNUM,8,ZD)),
         IFTHEN=(WHEN=(151,8,ZD,NE,+1),
            OVERLAY=(70:DATA1))
/*


In the input file has:

Code:

RECORD 1 12345678901
RECORD 2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
RECORD 3 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB


The output file will have:

Code:

RECORD 1 12345678901                                                           
RECORD 2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA12345678901
RECORD 3 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB12345678901


If that's not what you want, then please explain what you do want with an example.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Jul 20, 2007 9:21 pm
Reply with quote

Frank
I was very much keen about the positions, Chinnielr stated that the data is to be considered between 10 and 20th position and not from 10th to 20th position, So i considered from 11th position to 9 characters.
Please correct me if i am wrong icon_question.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 20, 2007 9:41 pm
Reply with quote

Quote:
I was very much keen about the positons


Not sure what "keen" means in this context.

Chinni said "between 10 and 20" and between "70 and 80". I interpreted that to mean 11 bytes in each case since it wouldn't make any sense otherwise. Obviously, what he said was rather ambiguous. I guess only Chinni knows for sure what's needed. I do wish people would state things clears so we don't have to guess.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Jul 20, 2007 10:32 pm
Reply with quote

"keen" : meant to say "concentrated"

Quote:
Obviously, what he said was rather ambiguous

Thats true icon_rolleyes.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 20, 2007 11:06 pm
Reply with quote

Quote:
"keen" : meant to say "concentrated"


Oh, I understand. I'd say "focused on" or "concentrating on" rather than "keen about". icon_smile.gif
Back to top
View user's profile Send private message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Sat Jul 21, 2007 1:09 pm
Reply with quote

Hi Frank,

Thanks for your prompt reply. Sorry for any confusion caused.

The positions between 10-20 in the first record is 0104000100. I want to replace all the contents between the positions 70-80 for all remaining records (from 2nd record onwards to the last record) with the value from first record ie., 0104000100. Hope I am clear. By the way can anyone please let me know the a way to do it using SYNCSORT???

Thanks in advance!!
chinni.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sun Jul 22, 2007 1:27 am
Reply with quote

I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Wed Jul 25, 2007 3:02 pm
Reply with quote

Hi Frank,

Could you please tell me in detail of the Syntax below
INREC BUILD=(C'DATA1,''',11,9,C'''',80:X)

Thanks and regards,
Kiran.
Back to top
View user's profile Send private message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Wed Jul 25, 2007 3:15 pm
Reply with quote

Hi frank,

DATA1 contains any value and we are refering that value in Step S2?
What does SYMNAMES refers to?

thanks and regards,
Kiran.
Back to top
View user's profile Send private message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Wed Jul 25, 2007 3:25 pm
Reply with quote

Is there a way to do this in a single step?
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Jul 25, 2007 4:32 pm
Reply with quote

chinnielr,

Quote:
Is there a way to do this in a single step?

Use ICETOOL.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jul 25, 2007 10:54 pm
Reply with quote

murmohk1

Though you use ICETOOL, if you are using (COPY/SELECT/SPLICE...) more than one statement, then its considered as multistep SORT only!
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 5
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
Search our Forums:

Back to Top