Write file layout in Rexx using cobol copy book



IBM's Command List programming language & Restructured Extended Executor

Write file layout in Rexx using cobol copy book

Postby surime72 » Tue Oct 29, 2013 3:20 pm

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.
surime72
 
Posts: 107
Joined: Sun Oct 23, 2011 1:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Write file layout in Rexx using cobol copy book

Postby enrico-sorichetti » Tue Oct 29, 2013 3:26 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Write file layout in Rexx using cobol copy book

Postby surime72 » Tue Oct 29, 2013 3:33 pm

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).
surime72
 
Posts: 107
Joined: Sun Oct 23, 2011 1:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Write file layout in Rexx using cobol copy book

Postby enrico-sorichetti » Tue Oct 29, 2013 3:41 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Write file layout in Rexx using cobol copy book

Postby NicC » Tue Oct 29, 2013 4:58 pm

As you have only DISPLAY data it is quite simple as long as you are comfortable with the PARSE facility in Rexx.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Write file layout in Rexx using cobol copy book

Postby surime72 » Tue Oct 29, 2013 5:40 pm

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
surime72
 
Posts: 107
Joined: Sun Oct 23, 2011 1:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Write file layout in Rexx using cobol copy book

Postby NicC » Tue Oct 29, 2013 8:00 pm

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).
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Write file layout in Rexx using cobol copy book

Postby enrico-sorichetti » Tue Oct 29, 2013 8:30 pm

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.
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Write file layout in Rexx using cobol copy book

Postby dick scherrer » Wed Oct 30, 2013 2:31 am

Hello,

Suggest until you have become Quite familiar with REXX, work on something else . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Write file layout in Rexx using cobol copy book

Postby prino » Wed Oct 30, 2013 2:52 am

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!
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post