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
 

 

Insert a particular value in all the records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Insert a particular value in all the records
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    Post subject:
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

Senior Member


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

PostPosted: Fri Jul 20, 2007 2:23 pm    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Jul 20, 2007 8:57 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Jul 20, 2007 9:41 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Jul 20, 2007 11:06 pm    Post subject:
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    Post subject: Re: Insert a particular value in all the records
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 Moderator


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

PostPosted: Sun Jul 22, 2007 1:27 am    Post subject:
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    Post subject: Re: Insert a particular value in all the records
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    Post subject: Re: Insert a particular value in all the records
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    Post subject: Re: Insert a particular value in all the records
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: 1439
Location: Bangalore,India

PostPosted: Wed Jul 25, 2007 4:32 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am


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