View previous topic :: View next topic
|
Author |
Message |
mainframebeginner Currently Banned New User
Joined: 19 May 2010 Posts: 7 Location: hyderabad
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
mainframebeginner Currently Banned New User
Joined: 19 May 2010 Posts: 7 Location: hyderabad
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
it must be x'0E7F8G9H' to be replaced by x'00051910' |
|
Back to top |
|
|
mainframebeginner Currently Banned New User
Joined: 19 May 2010 Posts: 7 Location: hyderabad
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
how big is the file?
record length
number of records
exact position in file where date needs to go..... |
|
Back to top |
|
|
mainframebeginner Currently Banned New User
Joined: 19 May 2010 Posts: 7 Location: hyderabad
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
mainframebeginner Currently Banned New User
Joined: 19 May 2010 Posts: 7 Location: hyderabad
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
|