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

command to update or add values to a particuler pos in Vb fi


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
praveenmaga

New User


Joined: 27 Jun 2009
Posts: 6
Location: Bangalore

PostPosted: Fri Nov 13, 2009 2:22 am
Reply with quote

Is there any command to write values to a particuler position in a VB file?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 13, 2009 2:58 am
Reply with quote

Hello,

Suggest you invest some more keystrokes and more completely describe your requirement. . .

Show what the input looks like and how you want the output to be written.

Mention the lrecl and recfm of the files.
Back to top
View user's profile Send private message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Nov 13, 2009 3:20 pm
Reply with quote

There is no need to differentiate VB file from FB in your program. Rexx places the value in the position that you give. This position is what you see in the file by giving cols.

You can use either Insert or Overlay function to place your string in the desired position in your file.

Say if you want to insert a string 'AA' in the fifth column(This is what I assume you meant by a 'particular position')

Code:

"EXECIO * DISKR INPUT (STEM INP. FINIS"
INP.1 = OVERLAY('AA',INP.1,5)         
"EXECIO * DISKW INPUT (STEM INP. FINIS"


The above code will read the file and place 'AA' in the fifth column in the first record.

VB makes difference only when you catalog a dataset using Rexx.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Nov 13, 2009 4:05 pm
Reply with quote

sathyaraj wrote:
VB makes difference only when you catalog a dataset using Rexx.

Can you explain this, as I have never come across any differences in 20+ years of using REXX
Back to top
View user's profile Send private message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Nov 13, 2009 5:02 pm
Reply with quote

I meant the record format (FB, VB) that we use while creating a new PS file using TSO command Allocate.
Plz correct me if I am wrong.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Fri Nov 13, 2009 5:23 pm
Reply with quote

sathyaraj wrote:
I meant the record format (FB, VB) that we use while creating a new PS file using TSO command Allocate.
Plz correct me if I am wrong.


And saying that grass is green is just as useful.
Back to top
View user's profile Send private message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Nov 13, 2009 5:39 pm
Reply with quote

Quote:

And saying that grass is green is just as useful.


Giving an additinal info doesnt gonna cause any harm. Thought it might be usefull to someone who is an alien to REXX. icon_wink.gif
Back to top
View user's profile Send private message
praveenmaga

New User


Joined: 27 Jun 2009
Posts: 6
Location: Bangalore

PostPosted: Fri Nov 13, 2009 9:31 pm
Reply with quote

thnx.
Sorry i might have missed this infn in my post.
I don't want to add hard coded values to output file.
it should be like this--
read a input file and take the values from colm 2 to 3
and write to the first record in colm 8 to 10 in the output file.
Back to top
View user's profile Send private message
praveenmaga

New User


Joined: 27 Jun 2009
Posts: 6
Location: Bangalore

PostPosted: Fri Nov 13, 2009 9:48 pm
Reply with quote

'EXECIO * DISKR HI (STEM LINES. FINIS'
DO I = 1 TO LINES.0
LINES.I = OVERLAY(LINES.I,2341)
'EXECIO * DISKW HI1 (STEM LINES. FINIS'
END

this is my code..
when i try this...its adding values to the first colums only in output file.
it should read first record and take the value from colm 2 to 3 and write to first record to a colm 7-8...so on,
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 13, 2009 9:51 pm
Reply with quote

To repeat:
Quote:
Show what the input looks like and how you want the output to be written.
It you had done as requested, you would have saved a day. . .
Back to top
View user's profile Send private message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Nov 13, 2009 10:12 pm
Reply with quote

Hope this works..

Code:

'EXECIO * DISKR HI (STEM LINES. FINIS' 
'EXECIO * DISKR HI1 (STEM LINES1. FINIS' 
DO I = 1 TO LINES.0                     
INP = SUBSTR(LINES.I,2,2)               
LINES1.I = OVERLAY(INP,LINES.I,7)       
END                                     
'EXECIO * DISKW HI1 (STEM LINES1. FINIS'


Assuming your input and output file has different data.. you just want to take field in position 2-3 in input and overlay it in position 7-8 in output and that you have equal number of input and output records.
Back to top
View user's profile Send private message
praveenmaga

New User


Joined: 27 Jun 2009
Posts: 6
Location: Bangalore

PostPosted: Fri Nov 13, 2009 10:39 pm
Reply with quote

Code:

/* REXX */
...
'EXECIO * DISKR HI (STEM LINES. FINIS'                           
DO I = 1 TO LINES.0                                               
  N = SUBSTR(LINES.I,1,5)                                           
  SAY N                                                             
  LINES.I = OVERLAY(N,LINES.I,2341)                   
END         
'EXECIO * DISKW HI1 (STEM LINES. FINIS'
EXIT     


I ran with this code now as you said... its overlaying at 2341 colm..also its overlaying in the starting colm 1. please advice.
Back to top
View user's profile Send private message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Nov 13, 2009 10:56 pm
Reply with quote

oh man....

It is not overlaying in the column one. you are taking fielnd in position 1-5 and placing in 2341.

so the field will be in 2341 and it will be in column 1 as it is its actual position...

That is the reason I have used different stem in my previous example for input and output. If your output data is different read it into a stem before overlapping.. and overlap the output stem with your substring in the desired position.

Hope this helps.
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
Search our Forums:

Back to Top