Page 1 of 1

Write file layout in Rexx using cobol copy book

PostPosted: Tue Oct 29, 2013 3:20 pm
by surime72
Hi,

Is it possible in rexx program by taking reference as cobol copy book and need to write the data in other files..?,I want it to be done with the help from REXX so that this tool becomes independant of any hard-coded values, so that in case my copybook structure changes in future, I don't have to change REXX.
Please advise on this. Please let me know if anything was not clear here.

Re: Write file layout in Rexx using cobol copy book

PostPosted: Tue Oct 29, 2013 3:26 pm
by enrico-sorichetti
all depends on the complexity of the copy book...
it is relatively simple if no redefines, no occurs, no arrays
much more complex/impossible otherwise

or You might want to look here
ftp://ftp.software.ibm.com/storage/dfso ... rttrck.pdf

should not be too difficult to change the output to generate
instead of the DFSORT SYMBOLS the REXX parse statements

but it would be a two stage approach

Re: Write file layout in Rexx using cobol copy book

PostPosted: Tue Oct 29, 2013 3:33 pm
by surime72
Thanks for your reply I don't have any knowledge on Rexx, there no redefines or no occurs or no arays,the lay out is as much as simple

same format

  01  WS-SGCPA17.
      10 GCPA15-GLOBL-FSA-R   PIC 9(9).
      10 GCPE10-HUB-C         PIC X(2).
      10 COUNTRY-ISO3-C       PIC X(3).
      10 FUND-CODE-C          PIC X(3).
      10 GCPA07-FSA-STAT-C    PIC X(1).
      10 GCPA17-FSA-STAT-S    PIC X(26).
      10 GCPD14-SEGMENT-R     PIC 9(4).
      10 GCPA17-FRC-COMPL-F   PIC X(1).
      10 GCPA17-CTRY-LNCH-Y   PIC X(10).
      10 GCPA17-OASIS-EFF-Y   PIC X(10).
      10 GCPA17-GVRCL-TYP-C   PIC X(1).
      10 GCPA17-EXP-SUPCD-F   PIC X(1).
      10 GCPA17-WKLY-LTR-F    PIC X(1).
      10 GCPA17-WKLY-VRPT-F   PIC X(1).
      10 GCPA17-FLUP-TEXT-F   PIC X(1).
      10 GCPA17-MTCH-RUN-F    PIC X(1).
      10 GCPA17-SUPP-CHG-F    PIC X(1).
      10 GCPA17-AGC-FLUP-F    PIC X(1).
      10 GCPA17-INIT-VINS-T-S PIC X(1).
      10 GCPA17-INIT-VINS-T   PIC 9(9).
      10 GCPA17-INIT-VINS-S   PIC X(26).
      10 GCPA17-ACT-COST-A-S  PIC X(1).
      10 GCPA17-ACT-COST-A    PIC 9(10).
      10 GCPA17-REL-DAM-F     PIC X(1).
      10 GCPA17-OPTN-CODE-F   PIC X(1).
      10 GCPA17-MISC-EXP-F    PIC X(1).
      10 GCPA17-FTP-FILE-N    PIC X(30).
      10 GCPA17-VIN-PURGE-Y   PIC X(10).
      10 GCPA17-FRC-Y         PIC X(10).
      10 GCPA17-FRZN-BY-C     PIC X(8).
      10 GCPA17-PARTICIP-F    PIC X(1).
      10 GCPA17-PARTICIP-Y    PIC X(10).
      10 GCPA17-REASON-F      PIC X(1).
 10 GCPA17-FSA-CMNTS-X.
    49 GCPA17-FSA-CMNTS-X-LEN  PIC 9(4).
    49 GCPA17-FSA-CMNTS-X-TEXT  PIC X(254).
 10 GCPA17-FTP-ADDR-X.
    49 GCPA17-FTP-ADDR-X-LEN  PIC 9(4).
    49 GCPA17-FTP-ADDR-X-TEXT  PIC X(254).

Re: Write file layout in Rexx using cobol copy book

PostPosted: Tue Oct 29, 2013 3:41 pm
by enrico-sorichetti
I don't have any knowledge on Rexx

unfortunately that makes the task pretty hard to accomplish
and sadly even so the rexx skills needed are a bit above the average

Re: Write file layout in Rexx using cobol copy book

PostPosted: Tue Oct 29, 2013 4:58 pm
by NicC
As you have only DISPLAY data it is quite simple as long as you are comfortable with the PARSE facility in Rexx.

Re: Write file layout in Rexx using cobol copy book

PostPosted: Tue Oct 29, 2013 5:40 pm
by surime72
Hi Enric/Nicc,

Yes I have data in the files but i need write the data into other with the same copy book,please let me know if i understood wrong

Nicc,

'Yes it's difficult but it is the challange to me to learn new technoloy with the help of you guys

Re: Write file layout in Rexx using cobol copy book

PostPosted: Tue Oct 29, 2013 8:00 pm
by NicC
Note that Rexx does not have such a concept as copybook which is why you need to understand the fundamentals of PARSE which can be used to split a variable/record into separate "chunks".

You can combine (concatenate) "chunks" to form a new variable/record. Note that a variable is only a record if it is read or written otherwise it is only referred to as a variable (or, in this little lecture, "chunk" which is a totally un-IT word).

Re: Write file layout in Rexx using cobol copy book

PostPosted: Tue Oct 29, 2013 8:30 pm
by enrico-sorichetti
furthermore REXX does not understand COBOLESE COMP/PIC thingies ...
to process the data You will have to carry on Yourself the proper conversion and decimal dot placement.

Re: Write file layout in Rexx using cobol copy book

PostPosted: Wed Oct 30, 2013 2:31 am
by dick scherrer
Hello,

Suggest until you have become Quite familiar with REXX, work on something else . . .

Re: Write file layout in Rexx using cobol copy book

PostPosted: Wed Oct 30, 2013 2:52 am
by prino
I'm pretty much clueless about all COBOL data formats, but I wrote what you are now trying to write for PL/I way back in 1992, also as a complete REXX newbie. It took me probably at least a hundred hours of my own time, but now, 21 years later it still works, be it that I never added support for PL/I's "UNION" and some features like REFER. However, once you figure out how to do it, you will be able to use your core, the COPY BOOK parser for many other purposes, my parser has back-ends that let me do formatted browse/view of files, it lets me build files, it lets me use it to to in-edit formatted views of records, and it even allows me to format data in system dumps.

Writing the code will be a challenge, but it will be fun!