Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Multiple record description entries.

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

New User


Joined: 18 Aug 2006
Posts: 45

PostPosted: Tue Oct 09, 2007 5:28 pm    Post subject: Multiple record description entries.
Reply with quote

Hi All,
I have 3 record layouts for an input file.One for header record,the other one for trailer record and lastly for detail record.I need to split the records in the input file based on record type.In this scenario can some one help me out in defining the FD section and also how the READ should be done.Plz provide an example.It will help me out to get a better view.


Regards,
Akshatha
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: Tue Oct 09, 2007 6:28 pm    Post subject:
Reply with quote

Hello,

Create an FD with 3 01's in it.

Read the file (no magic, just a simple READ f_n AT END etc).

Compare the record read to see if it is a header, detail, or trailer.

Process the record according to type.

Stop when end of file. . . .

Write your code and if you get stuck, post the part of the code that you have questions about.
Back to top
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: Chennai

PostPosted: Tue Oct 09, 2007 6:36 pm    Post subject: Reply to: Multiple record description entries.
Reply with quote

Hi Akshata,

Quote:
I have 3 record layouts for an input file.One for header record,the other one for trailer record and lastly for detail record.I need to split the records in the input file based on record type.In this scenario can some one help me out in defining the FD section and also how the READ should be done.Plz provide an example.It will help me out to get a better view



Use Like this,

Code:
FD INFILE-A                           
     RECORDING MODE IS VB             
     LABEL RECORDS ARE STANDARD       
01 INREC-A PIC  X(MAX LENGHT).

WORKING-STORAGE SECTION.
01  WS-INREC-A
    05 WS-REC-TYPE PIC X(2)
         88  HD-INREC  VALUES 'HEADER VALUE'.
         88  TR-INREC  VALUES 'TRAILER VALUE'.
         88  DT-INREC  VALUES 'DETAILED VALUE'.
    05 UR-NEXT-FIELD X(DECLARE FURTHER).



Declare variables Accordingly, Then Perform your READ in loop in two step.

In Procedure Division Do Like this,

Code:
PERFORM 1000-INIT-PARA THRU 1000-EXIT.
PERFORM 2000-PROCESS-PARA THRU EXIT UNTIL UR-CONDITION OR EOF.
GOBACK.

1000-INIT-PARA.
       INITIALIZE WHATEVER-YOU-WANT.
       ACCEPT WS-SYS-DATE FROM DATE    * IF IT IS NUCCESSARY.
       
       READ INFILE-A
             AT END SET EOF TO TRUE
             NOT AT END
             MOVE INREC-A  TO WS-INREC-A

             EVALUATE TRUE
                  WHEN HD-INREC
                    PERFORM 1010-UR-PROCESS THRU 1000-EXIT
                  WHEN OTHER
                     PERFORM 9999-ABEND-PARA THRU 1001-EXIT
             END-EVALUATE.
     
       IF EOF
           DISPLAY 'INPUT FILE IS EMPTY, FILE NAME IS:' DDNAME
           PERFORM 9999-ABEND-PARA THRU EXIT
       END-IF.

1000-EXIT.
        EXIT.

2000-PROCESS-PARA.
        READ INFILE-A INTO WS-INREC-A
            AT END
                SET EOF TO TRUE
        NOT AT END
               PERFORM 2100-UR-PROCESS-REQUIREMENMT THRU 2100-EXIT.
        DISPLAY 'PROCESS DONE'.

2000-EXIT.
        EXIT.


I hope it will be helpfull to you.

Let us know If you have any doubt.

Thanks & Regards
Back to top
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: Chennai

PostPosted: Tue Oct 09, 2007 6:45 pm    Post subject:
Reply with quote

Hi Dick,

Quote:
Create an FD with 3 01's in it.


Is it possible create three 01's FD declaration?

Please let us once you tried with this.. icon_question.gif

Thanks & Regards
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: Tue Oct 09, 2007 7:09 pm    Post subject: Reply to: Multiple record description entries.
Reply with quote

Hello,

Quote:
Is it possible create three 01's FD declaration?

Please let us once you tried with this..


Yes. Not only is it possible, but it is most common.

I believe i'll not "try it" (again) as it has worked for many, many years.
Back to top
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: Chennai

PostPosted: Tue Oct 09, 2007 7:30 pm    Post subject:
Reply with quote

Hi Dick,

Quote:
I believe i'll not "try it" (again) as it has worked for many, many years


That's fine, Currently I am on bench so that I couldn't able to check it out and hence I requested for you.

But for current requirement, how will you declare variable and code logic icon_question.gif

Thanks & Regards
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 7:30 pm    Post subject:
Reply with quote

Hemantha,

Quote:
Is it possible create three 01's FD declaration?

Please let us once you tried with this..

As Dick highlighted, its a very common practice in projects.

I had been discussed earlier. Search the forum.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 7:34 pm    Post subject:
Reply with quote

Hemantha,

Quote:
But for current requirement, how will you declare variable and code logic

I believe Dick had already answered 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: Tue Oct 09, 2007 9:06 pm    Post subject:
Reply with quote

Hello,

Quote:
But for current requirement, how will you declare variable and code logic
If, in the FD, multiple records (level 01) are defined, a "record type" field (much like you used) is near the front of the record within the FD (rather than in ws).

Usually "key" info is the first part of the record and the "record type" is the next field - it can be named in the first record and set as filler in other record types or it can have a different name in each record type.

If this is not clear, please post a reply.
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
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
This topic is locked: you cannot edit posts or make replies. SDSF multiple spool datasets extracte... PJAlarcon CLIST & REXX 1 Fri Apr 21, 2017 10:50 pm
No new posts Validating file with multiple header/... mohitsaini DFSORT/ICETOOL 6 Thu Apr 13, 2017 1:53 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us