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
 

 

Editing a PS file in a particular field using REXX\Macros

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
mainframebeginner
Currently Banned

New User


Joined: 19 May 2010
Posts: 7
Location: hyderabad

PostPosted: Wed May 19, 2010 11:37 pm    Post subject: Editing a PS file in a particular field using REXX\Macros
Reply with quote

Hi All,

I have written a code which edits the PS file but now i need to update a particular field with the current date.

suppose the data in the PS file is as follows
0000007890000000000000000000
00000EFGH0000000000000000000

now my requirement is i need to change E7F8G9 with the current date(051910) in a zigzag way...

Can anyone please help me in this and how to go to that particular byte position?

Any response much appreciated.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 19, 2010 11:58 pm    Post subject:
Reply with quote

Quote:
a code which edits the PS file


do you mean you have invoked an EDIT session for the file?

and what does
Quote:
in a zigzag way...
mean?

if E7F8G9 is the hex for 3 bytes,
then it is x'E7F8G9' to be replaced by x'051910'

and it is ISPF EDIT Macro, written in REXX!!
Back to top
View user's profile Send private message
mainframebeginner
Currently Banned

New User


Joined: 19 May 2010
Posts: 7
Location: hyderabad

PostPosted: Thu May 20, 2010 1:43 am    Post subject:
Reply with quote

Hi Dick,

Thanks for your valuable time.

Yes, i have opened the PS file in edit mode.

for your second question, Yes i need it in zigzag way and you got my point (x'E7F8G9' to be replaced by x'051910').

one more thing is i cant use "C ALL" code here. i need to go to that particular byte position and change it to date.

Please get back to me if anything is still not clear.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu May 20, 2010 1:45 am    Post subject:
Reply with quote

Hello,

Will the half-byte before and after the "zigzag date" always be the same (i.e. 0 and H)?

How are these 2 half-bytes used? What do they contain?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 20, 2010 1:53 am    Post subject:
Reply with quote

it must be x'0E7F8G9H' to be replaced by x'00051910'
Back to top
View user's profile Send private message
mainframebeginner
Currently Banned

New User


Joined: 19 May 2010
Posts: 7
Location: hyderabad

PostPosted: Thu May 20, 2010 1:58 am    Post subject:
Reply with quote

Hi dick scherrer,

I am really very sorry.. i didn't get your question.

Are you asking the data before and after the zigzag date is always same
? if this is the question then "Yes, always the data will be the same, only change is the date"

Actually what happens is.. there is an extract job which pick the data based on the date given in this file. so daily we need to change it to current date. so i am thinking to automate this process using rexx.

So i need to change only that particular position as date.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 20, 2010 2:25 am    Post subject:
Reply with quote

how big is the file?

record length
number of records
exact position in file where date needs to go.....
Back to top
View user's profile Send private message
mainframebeginner
Currently Banned

New User


Joined: 19 May 2010
Posts: 7
Location: hyderabad

PostPosted: Thu May 20, 2010 2:29 am    Post subject:
Reply with quote

This is a very small file having only 2 records.

I will post you the data here tomorrow same time if it is ok for you? becoz i am not at my PC.

Thanks a lot Dick for your valuable time and patience.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu May 20, 2010 2:53 am    Post subject:
Reply with quote

Zigzag is not a data format that I am familiar with, but I only have 40 years experience as IBM Mainframe programmer. What format is the data in Packed decimal, Binary or what. If those two line a suppose to be the hex representation of the data (in which case you may have the lines swapped) you need to be aware that you can't edit and change half bytes.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu May 20, 2010 3:27 am    Post subject:
Reply with quote

Hello,

DBZ wrote:
it must be x'0E7F8G9H' to be replaced by x'00051910'
Yup, hopefully, this will always be the case. . .

If it is, it should be an easy edit. . . Just specify the values in hex.

Or am i missing something. . .?
Back to top
View user's profile Send private message
mainframebeginner
Currently Banned

New User


Joined: 19 May 2010
Posts: 7
Location: hyderabad

PostPosted: Thu May 20, 2010 8:23 am    Post subject:
Reply with quote

Hi dick scherrer,

Yes, your are missing one thing here. we cant do replace here becoz everytime the date changes. we cant hard code that change x'0E7F8G9H' to x'00051910'.

i mean, today the date will be 052010 tomorrow will be 052110 so we cant hardcode in the code.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu May 20, 2010 8:41 am    Post subject:
Reply with quote

Hello,

Quote:
we cant do replace here becoz everytime the date changes. we cant hard code that change x'0E7F8G9H' to x'00051910'.

Then build up the value from the 2 constants (0 and H) and the current date from the system. You would have a character string, but when placed between x' and ' it is the result value for the "change".

What should happen if the job for Tuesday runs before midnight on Monday or after midnight on Wednesday? You need to consider just what should be used for "the date".
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 20, 2010 12:34 pm    Post subject:
Reply with quote

mainframebeginner,

you waste too much time saying what you want to say instead of answering questions.

again,
record length
number of records
exact position in file where date needs to go.... Columns

there is a good chance that a sort solution would be better than
you, an inexperienced REXX programmer,
providing a satisfactory solution.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Thu May 20, 2010 7:12 pm    Post subject: Reply to: Editing a PS file in a particular field using REXX
Reply with quote

Please correct me if wrong, but it looks like your sample data is the result of HEX ON command. The zigzag is because each character needs two hex digits to represent it.


You need an editor macro which:

1. uses the LINE macro instruction to read the record in your file
2. use PARSE rexx instruction to break up the line in to 3 sections
before the date, the date, after the date.
3. convert the current date into the format you need
4. combine the data into one variable
5. use the LINE macro instruction to replace the record in your file
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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