View previous topic :: View next topic |
Author |
Message |
vak255 Intermediate
Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Sat Oct 30, 2010 6:36 am Post subject: Insert a charcter 'Y' in VB file |
|
|
I have a VB file. I have to insert(not overwrite) 'Y' at 350 location in the records that start with ANR. I like to use sort. Rest of the record should be same. Thanks for your time and help. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Sat Oct 30, 2010 8:28 am Post subject: |
|
|
you realize of course that an INSERT of 1 char will increase the record length by 1 char. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Sat Oct 30, 2010 9:23 pm Post subject: |
|
|
vak255,
If the file length is greater than 354(4 bytes RDW) you are actually just overlying the contents at position 354 and not inserting.
Use the following control cards. If the record starts with 'ANR' then we will update the record with 'y' in position 354.
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(5,3,CH,EQ,C'ANR'),OVERLAY=(354:C'Y'))
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
vak255 Intermediate
Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Sun Oct 31, 2010 12:06 am Post subject: |
|
|
yes, the record length will increase by 1 char.
Thanks so much, Kolusu. . I would like to clarify on what will happen to the data at 354. I want the data from 354 onwards to shift to the next byte once the 'Y' is inserted. I will check this. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Sun Oct 31, 2010 11:40 am Post subject: |
|
|
vak255 wrote: | yes, the record length will increase by 1 char.
Thanks so much, Kolusu. . I would like to clarify on what will happen to the data at 354. I want the data from 354 onwards to shift to the next byte once the 'Y' is inserted. I will check this. |
Vak255,
If your intention is to shift the characters from 354 then you need build statement and not overlay
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(5,3,CH,EQ,C'ANR'),BUILD=(1,353,C'Y',354))
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
vak255 Intermediate
Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Mon Nov 01, 2010 12:59 am Post subject: |
|
|
Thanks again for all the support.
you are great |
|
Back to top |
|
|
vak255 Intermediate
Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Mon Nov 01, 2010 7:09 am Post subject: |
|
|
I have one more questions. I want to insert a 5 byte Fixed decimal (as defined in PL1) starting from 351.
shall I define like BUILD=(1,353,C'Y', PD'12345',354) |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Mon Nov 01, 2010 8:21 am Post subject: |
|
|
look up the BUILD info in the manual and you will understand how wrong you are. If you want it in 361 you have to copy bytes 1-350, insert your 3 byte PD field, copy bytes 351 and 352 after your PD field, insert your 'y' and then copy the rest from your new 'Y' position + 1. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Mon Nov 01, 2010 11:01 am Post subject: |
|
|
vak255 wrote: | I have one more questions. I want to insert a 5 byte Fixed decimal (as defined in PL1) starting from 351.
shall I define like BUILD=(1,353,C'Y', PD'12345',354) |
Vak255,
That is not the right syntax, use the following
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(5,3,CH,EQ,C'ANR'),
BUILD=(1,353,C'Y',+12345,TO=PD,LENGTH=5,354))
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
vak255 Intermediate
Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Tue Nov 02, 2010 2:00 am Post subject: |
|
|
Kolusu and NICK, Thanks a lot. |
|
Back to top |
|
|
|
|