Page 1 of 1
Writing a header using the data inside the input file
Posted:
Fri Apr 17, 2020 1:53 pm
by sreekanth_reddy
Hi,
My requirement is to build a sort card which will do the following this for me
My input data:
record length is 90
ABC .............[spaces]20200417(date)
DEF .............[spaces]20200417
GHI .............[spaces]20200417
1) i want a write the header with date, where date should be taken from the input file as mentioned as (date)
2) i want to change the record length from 90 to 20
3) i want to convert the data b/w 4th byte to 12th byte to HEX
output file should be like
Header (Date inside the input file)
ABC .............
DEF .............
GHI .............
please help me in writing sort for this condition.
Thanks in advance
Re: Writing a header using the data inside the input file
Posted:
Fri Apr 17, 2020 3:04 pm
by NicC
Please use the code tags when presenting data. As it stands, the data you posted is unclear - are the strings "[spaces]" actual data or some method of indicating spaces in your data?
Without code tags:
abc def
with code tags:
I cut and pasted the data between the two examples so it is
identical.
Re: Writing a header using the data inside the input file
Posted:
Fri Apr 17, 2020 4:39 pm
by sreekanth_reddy
Sorry for confusion
Input data:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9
AB 12 12 1 1 1 1 12 1 12 20200101
CD 12 12 1 1 1 1 12 1 12 20200101
EF 12 12 1 1 1 1 12 1 12 20200101
GH 12 12 1 1 1 1 12 1 12 20200101
Expected Output :
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9
Header: 20200101
AB 12 12 1 1 1 1 12 1 12
CD 12 12 1 1 1 1 12 1 12
EF 12 12 1 1 1 1 12 1 12
GH 12 12 1 1 1 1 12 1 12
Re: Writing a header using the data inside the input file
Posted:
Fri Apr 17, 2020 4:47 pm
by NicC
Use the sodding code tags! withoutthem the data does not line up.
Don't know what the code tags are? Research the forums. Or use the "POST REPLY" button instead of the "Quick Reply" button.
Meanwhile I have applied the tags to your data and aligned it properly,
Re: Writing a header using the data inside the input file
Posted:
Fri Apr 17, 2020 6:16 pm
by sergeyken
sreekanth_reddy wrote:1) i want a write the header with date, where date should be taken from the input file as mentioned as (date)
2) i want to change the record length from 90 to 20
3) i want to convert the data b/w 4th byte to 12th byte to HEX
0) RTFM, RTFM, and RTFM
1) there is a date field in every input record. Which one do you want to use for the header???
2) use BUILD= parameter
3) use option HEX within BUILD parameter
Re: Writing a header using the data inside the input file
Posted:
Fri Apr 17, 2020 9:22 pm
by sreekanth_reddy
there is a date field in every input record. Which one do you want to use for the header???
Ans: Every record has a date at last.. now i want remove that date at last for each record in the file and place single date as a header.
Here date is not current date or system date... date might be differs but all records in the file will be same date.
Re: Writing a header using the data inside the input file
Posted:
Sat Apr 18, 2020 1:18 am
by sergeyken
sreekanth_reddy wrote:there is a date field in every input record. Which one do you want to use for the header???
Ans: Every record has a date at last.. now i want remove that date at last for each record in the file and place single date as a header.
Here date is not current date or system date... date might be differs but all records in the file will be same date.
Which one do you want to use for the header???
Re: Writing a header using the data inside the input file
Posted:
Sat Apr 18, 2020 1:59 am
by NicC
As per the original post - the first record. But it can be from any record as, per the last post, each record has the same date.
Re: Writing a header using the data inside the input file
Posted:
Sat Apr 18, 2020 7:31 am
by sreekanth_reddy
Which one do you want to use for the header???
sergeyken
Ans: I want to keep first record date as header.
Why I said any record bcz there date is common for every record .
After writing that date as header... I want to truncate the date and reduce the record length.