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
 

 

COBOL Fundamentals : file structure

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

New User


Joined: 09 Jan 2009
Posts: 8
Location: Pune

PostPosted: Wed Mar 11, 2009 5:00 pm    Post subject: COBOL Fundamentals : file structure
Reply with quote

HI All,

Can anybody tell me ,Given the layout shown for CUSTMAST-REC, what are the correct values for 'x' and 'y' in the scenario above?

Code:
FD  CUSTMAST
   RECORD IS VARYING IN SIZE
   FROM x TO y CHARACTERS
   DEPENDING ON RECORD-LENGTH.

01  CUSTMAST-REC.
   05  CR-CUSTOMER-DATA.
       10  CR-CUSTOMER-ID       PIC X(10).
       10  CR-ORDER-COUNT       PIC 9(02).
    05  CR-ORDER-DATA            OCCURS 1 TO 20 TIMES
                                INDEXED BY CROD-INDEX.
       10  CR-ORDER-DATE          PIC X(08).
       10  CR-ORDER-ITEM          PIC X(10).
       10  CR-ORDER-QTY           PIC 9(05).
...
WORKING-STORAGE SECTION.
...
   05  RECORD-LENGTH              PIC 9(03).
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7990
Location: Bellevue, IA

PostPosted: Wed Mar 11, 2009 5:05 pm    Post subject:
Reply with quote

What values for x and y did you calculate?
Back to top
View user's profile Send private message
shobhit garg

New User


Joined: 09 Jan 2009
Posts: 8
Location: Pune

PostPosted: Wed Mar 11, 2009 5:13 pm    Post subject: Reply to: COBOL Fundamentals : file structure
Reply with quote

see these are possible answers..but i dont know which one is correct ?

x=12, y=35
x=33, y=422
x=35, y=472
x=12, y=500
x=35, y=700
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7990
Location: Bellevue, IA

PostPosted: Wed Mar 11, 2009 5:30 pm    Post subject:
Reply with quote

So this is a homework question?

How many bytes is CR-CUSTOMER-DATA?

How many bytes is each occurrence of CR-ORDER-DATA?

Once you figure those, simple arithmetic gives you the answers. If you can't figure them, you need to visit the manuals (link at the top of the page), find the COBOL Language Reference, and read up on DATA DIVISION fields and their lengths.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Wed Mar 11, 2009 5:34 pm    Post subject: Reply to: COBOL Fundamentals : file structure
Reply with quote

drowning in the kitchen sink...... why not use a bit of logic ???

&LENGTH1 length of the fixed part

&LENGTH2 length of one entry of the variable part

&OCCURS1 number of minimun number of entries

&OCCURS2 number of maximum number of entries

minimun total length = &LENGTH1 + &LENGTH2 * &OCCURS1
maximum total length = &LENGTH1 + &LENGTH2 * &OCCURS2

simple math and simple logic
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed Mar 11, 2009 6:15 pm    Post subject:
Reply with quote

Quote:
what are the correct values for 'x' and 'y' in the scenario above?
Actually, the 'x' needs to be no longer than the minimum length, and could be even shorter. The 'y' can be no shorter than the maximum length, and could be longer, up to the defined dataset's LRECL (minus the RDW).
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 Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm


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