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
 

 

partially intializing values from a layout

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

New User


Joined: 15 May 2006
Posts: 90

PostPosted: Thu Sep 11, 2014 9:23 am    Post subject: partially intializing values from a layout
Reply with quote

Hi there,

In my Cobol program, I am having a layout (copybook) for an output file. Now many fields in that copybook are hardcoded with some value as shown in the snippet below.

Now when I initialize the copybook then all the hardcoded fields are also intialized. However, what I require is that all the fields with VALUE should not be intialized and others should. Actually this output layout is very big and that's why individually intializing fields is quite a big task. Is there any COBOL syntax via which I can initialize the entire copybook except for fields with VALUE?

Code:
03  PG-MC-CB-TEX5.
  05  FILLER                  PIC X(06)      VALUE ':TTYP='. 
  05  PG-MC-CB-TEXT5          PIC X(06)      VALUE SPACES.

  05  FILLER                  PIC X(60)      VALUE SPACES.

03  PG-MC-CB-TEX6.
  05  FILLER                  PIC X(05)      VALUE ':TDT='.
  05  PG-MC-CB-TEXT6          PIC X(09)      VALUE SPACES.

  05  FILLER                  PIC X(58)      VALUE SPACES.

03  PG-MC-CB-TEX7.
  05  FILLER                  PIC X(06)      VALUE ':CPDT='.
  05  PG-MC-CB-TEXT7          PIC X(09)      VALUE SPACES.
[/code]
Back to top
View user's profile Send private message

Terry Heinze

JCL Moderator


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

PostPosted: Thu Sep 11, 2014 7:04 pm    Post subject:
Reply with quote

Elemetary FILLER data items are NOT initialized according to the Language Reference Manual.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1625
Location: NY,USA

PostPosted: Thu Sep 11, 2014 8:04 pm    Post subject:
Reply with quote

Always keep an eye out for fields under a REDEFINES. INITIALIZE will not look at these fields when it initializes the underlying storage. It will use the original definition - not the REDEFINED definition.

e.g.

Code:
IDENTIFICATION DIVISION.
PROGRAM-ID. STUFF.
* Test various cobol functions
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
*
01 REC-BUFF.
 03 RB1 PIC X(04)       VALUE “ABCD”.
 03     PIC X(02)       VALUE “ZZ”.
 03 FILLER      PIC X(03)       VALUE “QQQ”.
 03 RB2 PIC 9(04)       VALUE 1234.
 03     PIC 9(02)       VALUE 99.
 03 FILLER      PIC 9(03)       VALUE 777.
*
PROCEDURE DIVISION.
*
A1000-INIT.
                DISPLAY ‘[‘ REC-BUFF ‘]’.

                INITIALIZE REC-BUFF.
                DISPLAY ‘[‘ REC-BUFF ‘]’.

                MOVE SPACES TO REC-BUFF.
                DISPLAY ‘[‘ REC-BUFF ‘]’.

                INITIALIZE REC-BUFF.
                DISPLAY ‘[‘ REC-BUFF ‘]’.
                STOP RUN.

Output:

[ABCDZZQQQ123499777]
[    ZZQQQ000099777]
[                  ]
[         0000     ]
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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm


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