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: 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: 1653
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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Remove junk values in a file and rite... KP1125 DFSORT/ICETOOL 2 Wed Jan 25, 2017 9:58 pm


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