View previous topic :: View next topic
|
Author |
Message |
Sahoo
New User
Joined: 08 Jun 2006 Posts: 53
|
|
|
|
Hi,
Input to the program :
1) File Layout
2) File having Data
Outout would be :
Record Counter Field Name Field Value
Record counter will be running sequence and field name will be as given in the layout and Value will be picked up from the data file.
Is it possible to write a COBOL or rexx program to achieve this? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Is File Aid available at your site? |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
@ Sahoo
>> Is it possible to write a COBOL or rexx program to achieve this???
Answer: Sir, yes Sir, Sir !!! |
|
Back to top |
|
|
Sahoo
New User
Joined: 08 Jun 2006 Posts: 53
|
|
|
|
If yes, can you provide some guideline on how to do this |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The easiest way with cobol is probably to read a record and then issue a display like this:
Code: |
DISPLAY 'FIELD-NAME = ' FIELD-NAME. |
and repeat for each field.
If you want a more formal output, you could define an FD for an output file and write headings and generate page breaks, etc. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
If you use DISPLAYs, you can avoid confusion of leading or trailing spaces by coding something like:
Code: |
DISPLAY 'FIELD-NAME: '<' FIELD-NAME '>' |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
One more thought. . .
If you DISPLAY the fields in the file, it would be best to not display group fields that have packed or binary numeric elementary fields. |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
I believe that he wants to read the file layout from an input file not hard code it in the displays. As stated if you have File Aid it could do it for you. Otherwise it can be done in a COBOL program, but depending on the format of the file layout file it may not be easy. 1) read the file layout file and store it in working storage in occurs. 2) read each record from the data file loop through the layout table using reference modification extract the data values, convert it as needed for readable output and write the field name and value. It will help if the file with the file layout contains the starting location, length and type of each field not just the COBOL copybook, otherwise you will need to parse the copybook and calculate the starting location and length of each field. |
|
Back to top |
|
|
Sahoo
New User
Joined: 08 Jun 2006 Posts: 53
|
|
|
|
Douglas Wilder
What you mentioned is write. I need a generic program which will work for any layout i give.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I believe everyone understands what you want. It is available in FileAid.
Quote: |
I need a generic program which will work for any layout i give.... |
If you write your own, it will probably be no small effort. . .
Quote: |
It will help if the file with the file layout contains the starting location, length and type of each field not just the COBOL copybook, otherwise you will need to parse the copybook and calculate the starting location and length of each field |
As Douglas mentioned, if the displacement, length, and type are not available, you will need to either write the equivalent of the compiler to parse data division entries or find some way to otherwise obtain them. Two other ways are using the output from a compile or converting the cobol copybook to an Easytrieve layout (if your system uses Easytrieve). |
|
Back to top |
|
|
Sahoo
New User
Joined: 08 Jun 2006 Posts: 53
|
|
|
|
It is available in file-aid but can it be saved to a file? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The output from a batch job can be written to dasd instead of sysout.
FileAid can run in batch. . .
If i remember correctly, you may be able to do all of the setup online and then submit to batch which would generate the necessary jobstream for you. |
|
Back to top |
|
|
|