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

Find and Replace date in hexa decimal


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sivasree03

New User


Joined: 12 Sep 2008
Posts: 8
Location: chennai

PostPosted: Sat Mar 19, 2011 9:34 am
Reply with quote

Hi,

I have to change few dates in hexa decimal format in a sequential file. We will have the dates in different positions. I have to search and replace them.
For example we will have the dates from FEB 01 to FEB 28. We need to change all these dates to MAR 15.

Currently we are using C ALL command for each date and changing all dates to MAR 15. The dates will be from x'1110201c' to x'1110228c'

If anybody of you know logic for this, could you please help me?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sat Mar 19, 2011 11:22 am
Reply with quote

What sort of logic? Business logic? Program algorithm?
Why are you changing it to x'1110228c' when you say you want to change it to 15th of March which is x'1110315c'?
Are the dates in fixed places? If so you could write a small COBOL, or other language, program to read in each record, change the date and write the record out again.
If the dates are not in fixed positions you could write an ISPF edit macro to do what you do manually.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Sat Mar 19, 2011 10:30 pm
Reply with quote

Quote:
...will have the dates from FEB 01 to FEB 28


I think the poster meant: "...will have the dates from FEB 01 through FEB 28'
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Sat Mar 19, 2011 10:45 pm
Reply with quote

Here is the logic:
1. create editor macro in rexx, that includes this line:
Code:
"C ALL x'1110201c'  x'1110315c' "

2. repeat the line 27 times
3. use the mouse to copy the sequence numbers (01 through 28) that are shown in the left margin of the editor. Copy a tall but thin area that includes the last two digits of the sequence number and for 28 lines deep.
4. Paste that over the day position in the editor change commands so that each one will now have a different date value (01 through 28).

The point being that sometimes a low tech approach is faster.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Sat Mar 19, 2011 11:23 pm
Reply with quote

Since the "from" value is all possible values of the DAY portion (excluding Feb 29th ) it might be easier to just use the Picture clause of the Editor Change Command - i.e. C P'11102==' C'1110315' ALL
Back to top
View user's profile Send private message
Michael Jakob

New User


Joined: 13 Mar 2011
Posts: 17
Location: Switzerland

PostPosted: Sun Mar 20, 2011 12:16 am
Reply with quote

Hi, do you expect anything like this?

Edit-Macro
Member CHGDAT
/* REXX */
ADDRESS 'ISPEXEC'
"ISREDIT MACRO (fromDate1 fromDate2 toDate pos)"

ix1 = right(fromDate1,2);
ix2 = right(fromDate2,2);

do ix=ix1 to ix2;
myDate = left(Date1,4)!!right(ix,2);
"isredit" "change x'"myDate"' x'"toDate"' ALL "pos
end;

"ISREDIT" "MEND"
EXIT 0

The call should work like this
COMMAND ==> CHGDAT 110201 28 110315 117
CHGDAT: Edit-Macro
110201: From Date - Feb 01 2011
28: Last From Date for Feb 28 2011
110315: Change to Date
117: Position
Back to top
View user's profile Send private message
sivasree03

New User


Joined: 12 Sep 2008
Posts: 8
Location: chennai

PostPosted: Sun Mar 20, 2011 7:00 pm
Reply with quote

Thanks all for your reply.
Michael,
The FROM date position is not constant, it can be any where in sequential 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 -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top