Page 1 of 2

input and output file description.

PostPosted: Sat May 15, 2010 2:58 am
by dhoomphatash
I am trying to copy one records from an input file, say FILE1, to an output file,say FILE2. the input and output files are sequentially organized and access mode is sequential too. Now my question is do I have to have the same file description of the files.

like say.

.....
PROGRAM DIVISION.
FD FILE1.
01 FILE1-REC.
    05 NAME PIC X(10).
    05 PHONE-NUMBER PIC 9(13).
    05 FILLER PIC X(57).


Now should the output file description be same or can vary if needed?


FD FILE2.
01 FILE2-REC.
    05 NAME1 PIC X(10).
    05 PHONE-NUMBER1 PIC 9(13).
    05 FILLER PIC X(57).


working on z10 record length 80.

Re: input and output file description.

PostPosted: Sat May 15, 2010 3:35 am
by Robert Sample
As long as the total record size is the same, you can define either file any way you want. You can even have multiple record layouts.

Re: input and output file description.

PostPosted: Sat May 15, 2010 4:11 am
by dick scherrer
Hello and welcome to the forum,

Just make sure the input data matches the input layout(s). Otherwise strange results or abends may happen.

Re: input and output file description.

PostPosted: Sat May 15, 2010 3:45 pm
by Anuj Dhawan
Why not just try that?

Re: input and output file description.

PostPosted: Sat May 15, 2010 7:38 pm
by dhoomphatash
I tried it but a SOC4 error comes up to abend the program.
So thought of just to make sure I am not wrong with that concept.

Re: input and output file description.

PostPosted: Sat May 15, 2010 7:45 pm
by dhoomphatash
just another question... can 123.45 be put in a variable with picture

pic 999v99.
or
pic X(6).

Re: input and output file description.

PostPosted: Sat May 15, 2010 7:55 pm
by Robert Sample
Yes, and yes. Assuming USAGE DISPLAY, the first variable would be stored as X'F1F2F3F4F5' while the second would be stored as X'F1F2F34BF4F5'

Re: input and output file description.

PostPosted: Sat May 15, 2010 10:39 pm
by dick scherrer
Hello,

The s0c4 is more likely caused by referring to the fields when they are "not available" - such as when the file is not open or after a read that was not successful..

Re: input and output file description.

PostPosted: Sun May 16, 2010 8:52 am
by dhoomphatash
Thanks for the help. :)

Re: input and output file description.

PostPosted: Sun May 16, 2010 9:45 am
by dick scherrer
You're welcome - does this mean the program is now working?

If yes, it will help someone later if you post the solution :)

d