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 

Insert a charcter 'Y' in VB file

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


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Sat Oct 30, 2010 6:36 am    Post subject: Insert a charcter 'Y' in VB file Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Sat Oct 30, 2010 8:28 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Sat Oct 30, 2010 9:23 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Sun Oct 31, 2010 12:06 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Sun Oct 31, 2010 11:40 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Mon Nov 01, 2010 12:59 am    Post subject: Reply with quote

Thanks again for all the support.
you are great Smile
Back to top
View user's profile Send private message
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Mon Nov 01, 2010 7:09 am    Post subject: Reply with quote

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
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Nov 01, 2010 8:21 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Nov 01, 2010 11:01 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Tue Nov 02, 2010 2:00 am    Post subject: Reply with quote

Kolusu and NICK, Thanks a lot.
Back to top
View user's profile Send private message
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