IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Declare the variable with 88 level


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mahi

New User


Joined: 04 Apr 2006
Posts: 86
Location: Hyderabad

PostPosted: Wed Aug 27, 2008 1:30 pm
Reply with quote

Hi...

IN my detail ercord I have a record type field and some other fields.
in working storage I have declared.

05 sw-hdr-type-ldc pic x.
88 hdr-type-ldc value '1'.
05 ldc-name
05 ldc-cntr

So while writing the output record Is it required to move '1' to the sw-hdr-type-ldc field. Or I can write it directly as i have given the value in the 88 clause.

What is the value if we declare the variable with 88 level as above.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Aug 27, 2008 1:43 pm
Reply with quote

mahi,

Quote:
So while writing the output record Is it required to move '1' to the sw-hdr-type-ldc field


You can do either of these

- Move '1' to the 05 level field
- Set the 88 level variable to TRUE

Quote:
What is the value if we declare the variable with 88 level as above.


It will have the initialized value before you move anything to that field.
Back to top
View user's profile Send private message
mahi

New User


Joined: 04 Apr 2006
Posts: 86
Location: Hyderabad

PostPosted: Wed Aug 27, 2008 3:20 pm
Reply with quote

Thank you Auru...

It wont contain the value '1' unless we move the value to it eventhough we are giving the value in the 88 level...Am I right?
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Aug 27, 2008 3:22 pm
Reply with quote

Mahi,

Quote:
It wont contain the value '1' unless we move the value to it eventhough we are giving the value in the 88 level...Am I right?


Yep, you are correct.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Wed Aug 27, 2008 5:14 pm
Reply with quote

An 88 level is a conditional check. You don't give a value in an 88 level, you specify the value(s) for which the condition is true. For example,
Code:
88  TEST-SWITCH  VALUE 10 THRU 19.
is valid and TEST-SWITCH will be TRUE any time the variable value is in the range 10 through 19; less than 10 or greater than 19 and TEST-SWITCH is FALSE.
Back to top
View user's profile Send private message
Selva-kumar

New User


Joined: 01 Mar 2007
Posts: 52
Location: chennai

PostPosted: Wed Aug 27, 2008 5:45 pm
Reply with quote

Hi,

You can declare the field in the following way.


Code:

05 sw-hdr-type-ldc pic x value '1'.
88 hdr-type-ldc value '<some other value>'.


if declared as such, the 05 field will have the value '1' by default and when you set hdr-type-ldc to true, the value in it will be moved to the 05 field.
Back to top
View user's profile Send private message
Sagar_mainframe

New User


Joined: 07 Jun 2008
Posts: 34
Location: Harrisburg, Pennsylvania

PostPosted: Tue Sep 02, 2008 8:57 pm
Reply with quote

Code:
01  WS-DRADDR-ST                PIC X(02) VALUE SPACES.       
    88 INVALID-ST               VALUE '  '.                                       --two spaces     
    88 VALID-ST                 VALUE  'WA', 'OR', 'NV' ,'CA' ,
          'UT', 'AZ', 'MT', 'WY', 'CO', 'NM', 'ND', 'SD', 'NE',
          'KS', 'OK', 'TX', 'MN', 'IA', 'MO', 'AR', 'LA', 'WI',
          'IL', 'MS', 'MI', 'IN', 'KY', 'TN', 'AL', 'OH', 'WV',
          'VT', 'NY', 'PA', 'VA', 'NC', 'SC', 'GA', 'FL', 'NB',
          'ME', 'CT', 'DE', 'MD', 'PE', 'NS', 'NH', 'MA', 'RI',
          'ID', 'NJ'.                                         


Can I use the Evaluate clause directly as follows?
Code:
EVALUATE WS-DRADDR-ST                       
     WHEN VALID-ST                     
         CONTINUE                     
    WHEN INVALID-ST                   
         MOVE 'ZZ'       TO DRADDR-ST
    WHEN OTHER                       
         MOVE 'ZZ'       TO DRADDR-ST
    END-EVALUATE.                         
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Sep 02, 2008 9:02 pm
Reply with quote

You can.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Tue Sep 02, 2008 9:28 pm
Reply with quote

It might be simpler with
Code:
EVALUATE WS-DRADDR-ST                       
     WHEN VALID-ST                     
         CONTINUE                     
    WHEN OTHER                       
         MOVE 'ZZ'       TO DRADDR-ST
    END-EVALUATE.                         
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts How to load to DB2 with column level ... DB2 6
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
Search our Forums:

Back to Top