We need to migrate files to WINDOWS, for this purpose, the packed decimal fields needs to be Unpacked.
I am looking to code a generic COBOL program which can be used to unpack COMP/COMP-3 fields to corresponding length Non-Comp field. I will be having 2 input files. First file will be the one to be unpacked. Second file will contain info about the layout of the file in below format
START POS(1-4) END-POS(5-8) DATATYPE(9-10)
1 3 PD
Above is example for S9(5) COMP-3, occupying 3 bytes which needs to be moved to PIC S9(5) occupying 6 bytes in DISPLAY format.
I can make the input file as VARYING with maximum length possible and also, the output file as VARYING in order to accomodate the increased LRECL.
Is this workable? If so, Can you please give me an idea on how to code this?
I hope i made it clear, if not please let me know.
The second file, that is the layout file will be a manual file so we can add info expected by you like whether field is SIGNED or UNSIGNED. In the file to be migrated, it can contain mixed types.
I do agree that this could be done in SORT with OUTREC fields, EDIT mentioning SIGN, but as conveyed earlier i am looking to make something GENERIC so that once we manually make the layout file with information
START POS END POS DATATYPE SIGNED/UNSIGNED
1 3 PD S
I am expecting it to get unpacked to corresponding DISPLAY format.
Since we have 250 files, and for all file, SORT card cannot be coded manually so thinking to make this generic.
Do you think if not in COBOL, by REXX could we make this work?
If I had to do this, I would do it in COBOL, and maybe I would use the whole copybook as parameter ("2nd file").
But I would have a few questions, like:
In which format the file is expected, on the PC side: plain flat file, CSV, XML ?
Are there also COMP values ?
What about dates ?