View previous topic :: View next topic |
Author |
Message |
svhgk Beginner
Joined: 14 Feb 2006 Posts: 12 Topics: 5
|
Posted: Thu Sep 28, 2006 9:16 pm Post subject: Converting a Wrapped file to Unwrapped |
|
|
Hello,
I have a file with the following format.
Header - 50 bytes
Detail - 100 bytes
Trailer - 50 bytes.
This file is a sequential file with file type as FB 100 bytes record length. This file is wrapped using an assembler program into 80 byte record length file FB. This wrapping is typical to what happens when we switch the word wrap feature on in notepad. The 100 byte record will be split into 80+20 into 2 lines.
I need to unwrap this file.
I am planning to write a cobol program which will unwrap this. It will read the records from this wrapped file & then write it to a fixed byte file.
What I want to know is if the below logic will work:-
1. perform a READ on the input unwrapped file
2. write the READ record into an output FB 100 byte file.
Can I assume that when I perform a READ on the wrapped file it will return in the following way:-
1st READ - return the Header record
2nd READ - returns the Detail record
3rd READ - returns the Trailer record.
Please correct me if I am wrong.
Thanks, |
|
Back to top |
|
 |
Bill Dennis Advanced

Joined: 03 Dec 2002 Posts: 579 Topics: 1 Location: Iowa, USA
|
Posted: Fri Sep 29, 2006 1:31 pm Post subject: |
|
|
Your step 1 says "read unwrapped file". Are you reading the wrapped file or an unwrapped copy?
If reading the wrapped file of 80 bytes records, thats what you'll get on each read. It would take two reads to piece together a 100 byte record. _________________ Regards,
Bill Dennis
Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity. |
|
Back to top |
|
 |
coolman Intermediate
Joined: 03 Jan 2003 Posts: 283 Topics: 27 Location: US
|
Posted: Fri Sep 29, 2006 1:38 pm Post subject: |
|
|
Such questions could be better illustrated with an example:
Say if
Code: |
RECORD1AAAAAAAAAAAAAA < spaces for renaming bytes until 80>
RECORD2
|
Do you want RECORD2 to be appended starting from the 81st byte (or) do you want it to be appended at the end of the last non-blank character in the text.
________
volcano vaporizer |
|
Back to top |
|
 |
|
|