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

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


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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
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
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

Moderator Emeritus


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

PostPosted: Thu May 20, 2010 1:45 am
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
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
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
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
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
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

Moderator Emeritus


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

PostPosted: Thu May 20, 2010 3:27 am
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
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

Moderator Emeritus


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

PostPosted: Thu May 20, 2010 8:41 am
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
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

Global Moderator


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

PostPosted: Thu May 20, 2010 7:12 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top