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
 
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: 92

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: 1249
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: 1827
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 Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 4 Tue Jul 25, 2017 12:12 am

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