Page 1 of 1

Merge TAPE files using SORT

PostPosted: Tue Jan 29, 2013 3:21 pm
by pecram24
hi,

I am trying to merge two TAPE files of (Format VB ) into a new TAPE file ( Format VB ). All the files are having same record length of 32137.
The First File is having Detail Records and the Second file is having Trailer Records. I am able to create the output TAPE file.
But the Issue is, when i am trying to move the Trailer Record from 5000 to 32137 into a Variable in COBOL it fails in S0C4.
When i am displaying the content, for the Tape file it shows SPACES and \. If we run the COBOL program after converting the TAPE file into DASD the program is running fine and the display shows some junk values, the previous record values. ( But not the Last before record ).

\
Please help me in this.

Re: Merge TAPE files using SORT

PostPosted: Tue Jan 29, 2013 8:01 pm
by BillyBoyo
So is this a Cobol question, or a Sort question?

Usually, the point of VB files is to have different record-lengths on them. Although you say they are all the same length, I'd guess that your trailer record is much shorter than your other records (if you are accurate about those all being the same length). If the trailer is short, I guess the header is also short, although you may notice it less because of not getting a S0C4.

Re: Merge TAPE files using SORT

PostPosted: Wed Jan 30, 2013 7:03 am
by pecram24
Hi,


As u said the Trailer record content is very short when we compare it with the Details records. Say if the Details records are having details from 1 - 30000, the trailer records are having the info from 1- 500. i Doubt that during the sort the contents are moved from detail records to the Trailer records from char 500 . Could you please confirm is there any chance for it ?

Thanks!
Ram

Re: Merge TAPE files using SORT

PostPosted: Wed Jan 30, 2013 12:23 pm
by BillyBoyo
If you show your Sort cards, we can tell.

Re: Merge TAPE files using SORT

PostPosted: Wed Jan 30, 2013 12:42 pm
by pecram24
SORT FIELDS=(5,23,A,59,12,A,38,2,A,50,1,A),FORMAT=CH

Re: Merge TAPE files using SORT

PostPosted: Wed Jan 30, 2013 1:28 pm
by BillyBoyo
No, your "sort cards" are all the "cards" which you have under //SYSIN DD *. That which you have shown is a "sort card" which is a SORT statement.

It would have been clearer, I hope, if I had said "your Sort Control Cards".

Re: Merge TAPE files using SORT

PostPosted: Wed Jan 30, 2013 1:37 pm
by pecram24
yeah i got.. but there is only one sort card which i used to merge the files..

Re: Merge TAPE files using SORT

PostPosted: Wed Jan 30, 2013 3:44 pm
by BillyBoyo
OK, so we can confirm "NO" to the question of whether SORT, in your particular case, is being told to anything other than sort the trailer record.

Which leaves you with your Cobol program, and when the trailer is being processed you have incorrect references to data "beyond" the end of the trailer record, which will sometimes "work" (pick up other data from one of the "input buffers") and sometimes abend with S0C4 because you are at that time looking "outside" (probably) the last "input buffer".

Re: Merge TAPE files using SORT

PostPosted: Wed Jan 30, 2013 4:04 pm
by pecram24
Okay.. Thanks for your information.