How to extract all fields of a copybook to output file

IBM's Command List programming language & Restructured Extended Executor

How to extract all fields of a copybook to output file

Postby ritnihi » Wed Dec 28, 2011 5:46 pm


I am new to REXX. So please guide me to find out the solution.

Description: I need to generate one tool using REXX, through which I can pass one copybook name in input.And it will populate all the fields of the copybook to an output file.

Please find the attached doc with the panel (Only 8 digit copybook is the input) which I have created now, but I am not able to get the REXX code to do this.

Copybook looks like,


15 ABCCC001-AH1-ACTN PIC X(04).

Please let me know in case my requirement is not clear.

Thanks in Advance,
You do not have the required permissions to view the files attached to this post.
Posts: 9
Joined: Wed Dec 28, 2011 5:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to extract all fields of a copybook to output file


Re: How to extract all fields of a copybook to output file

Postby Robert Sample » Wed Dec 28, 2011 6:56 pm

What you are wanting to do is not a trivial exercise if you want to handle any arbitrary copybook. You will need to consider OCCURS, REDEFINES, and RENAMES -- and what are you going to do with OCCURS DEPENDING ON?

Further, what does "So please guide me to find out the solution." mean, exactly? If you are wanting code, then you are asking professionals for their work product and you should expect to pay the going rate for such code -- typical rates are around 1000 U.S. dollars or euros per day spent coding. If you are wanting something else, you need to tell us what you've done so far and what you need help with. If you have not done anything yet, then I suggest you WRITE SOME REXX CODE and run it against a test copybook so you can either get it running or tell us where, precisely, you are having problems.
Robert Sample
Global moderator
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: How to extract all fields of a copybook to output file

Postby BillyBoyo » Wed Dec 28, 2011 7:27 pm

Yes, your requirment is unclear.

If you are trying to put data into a record which conforms to the definition of a copybook, then Robert has pointed out some of the problems. It is not a task for someone new to rexx (or any language). To get it to operate correctly, you have to produce code to mimic the Cobol compiler.

If you are trying to put the contents of a copybook into an output dataset, that is easier. Indeed, you'd not need a "tool" to do it, as various methods exist with various utilities.

You'll have to better describe what it is you are trying to achieve.
Global moderator
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Return to CLIST & REXX


  • Related topics
    Last post