Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Displaying field names along with its value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Sahoo

New User


Joined: 08 Jun 2006
Posts: 53

PostPosted: Tue Jun 02, 2009 12:22 am    Post subject: Displaying field names along with its value
Reply with quote

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
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8200
Location: East Dubuque, Illinois, USA

PostPosted: Tue Jun 02, 2009 12:49 am    Post subject:
Reply with quote

Is File Aid available at your site?
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Tue Jun 02, 2009 4:01 pm    Post subject:
Reply with quote

@ Sahoo

>> Is it possible to write a COBOL or rexx program to achieve this???

Answer: Sir, yes Sir, Sir !!!
Back to top
View user's profile Send private message
Sahoo

New User


Joined: 08 Jun 2006
Posts: 53

PostPosted: Thu Jun 04, 2009 7:41 am    Post subject: Reply to: Displaying field names along with its value
Reply with quote

If yes, can you provide some guideline on how to do this
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jun 04, 2009 7:47 am    Post subject:
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Jun 04, 2009 8:50 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jun 04, 2009 8:56 am    Post subject:
Reply with quote

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
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Thu Jun 04, 2009 7:53 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Sahoo

New User


Joined: 08 Jun 2006
Posts: 53

PostPosted: Fri Jun 05, 2009 5:37 am    Post subject: Reply to: Displaying field names along with its value
Reply with quote

Douglas Wilder
What you mentioned is write. I need a generic program which will work for any layout i give....
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 05, 2009 5:44 am    Post subject:
Reply with quote

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
View user's profile Send private message
Sahoo

New User


Joined: 08 Jun 2006
Posts: 53

PostPosted: Sat Jun 06, 2009 10:45 pm    Post subject:
Reply with quote

It is available in file-aid but can it be saved to a file?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Jun 07, 2009 2:51 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us