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

populating value into a variable - REG


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Mon Sep 27, 2010 10:05 pm
Reply with quote

hi all,

look at the code below,

Code:
IF SUB6 < 10                                 
    MOVE '01' TO RAR-RATE-ERROR-SW           
    ADD +1 TO SUB6                           
    MOVE '1030' TO RAC-RATE-ERROR-CODE (SUB6)
    GO TO Y100-RETURN-CNTL.                 


Declaration of SUB6 is,

Code:

01  WS-INDEXES.                                               
    05  FLD-MAP-INDEX              PIC S9(4) COMP VALUE ZEROS.
    05  DATE-INDEX                 PIC S9(4) COMP VALUE ZEROS.
    05  CHAR-IX                    PIC S9(4) COMP VALUE ZEROS.
    05  MONTH-IX                   PIC S9(4) COMP VALUE ZEROS.
    05  SUB1                       PIC S9(4) COMP VALUE ZEROS.
    05  SUB2                       PIC S9(4) COMP VALUE ZEROS.
    05  SUB3                       PIC S9(4) COMP VALUE ZEROS.
    05  SUB4                       PIC S9(4) COMP VALUE ZEROS.
    05  SUB5                       PIC S9(4) COMP VALUE ZEROS.
    05  SUB6                       PIC S9(4) COMP VALUE ZEROS.
    05  SEC-IX                     PIC S9(4) COMP VALUE ZEROS.
    05  WS-FIELD-HOLD-LENGTH       PIC S9(4) COMP VALUE ZEROS.


sub6/ws-indexes is not initialized anywhere in the program.
no value is moved.

it is not passed through commarea also.

is there any other way to populated/put value into sub6?
This is my production module written in 1988.

Please help.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Sep 27, 2010 10:14 pm
Reply with quote

Because all data-fields under group WS-INDEXES are COMP, you can substitute all the VALUE clauses with the following single MOVE statement at program-start -
Code:

MOVE LOW-VALUES TO WS-INDEXES.

Is this what you need resolved?

Keep in mind, if this program was originally OS/VS COBOL, many programmers were lazy, in that they didn't initialize fields.

However, when VS/COBOL II was introduced, IBM added a run-time option named WSCLEAR to initialize the storage.

Bill
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Mon Sep 27, 2010 10:26 pm
Reply with quote

Thanks for the reply Bill.
I am not asking how to put value into the variable.
What I am asking is,

No move statement is used in the program which means there is no value in sub6(variable).
But still they are checking if it is less than 10.
if less than 10 they are throwing an error.

I dont know from where the value is loaded into the variable. I am trying to figure out from where the value is loaded.
1) no value is moved to sub6 or to ws-indexes.
2) This variable is not passed from previous program's commarea.
3)This variable is not passed to any other program via commarea from the current program.

In this case, from where do you think the value is loaded into the variable(sub6).

Please ask me if my explanation is not understandable.
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Mon Sep 27, 2010 10:44 pm
Reply with quote

Quote:
I dont know from where the value is loaded into the variable. I am trying to figure out from where the value is loaded.



If production program 1988, are you saying it doesn't work anymore ?

too little information in your request, without seeing the whole source program, how do you expect this forum to perform BASIC DEBUGGING for you ?[/url]
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Sep 27, 2010 10:53 pm
Reply with quote

The program's listing should show you all the places where SUB6 is being referenced.

I'm assuming this is a CICS program, because you talk about a commarea?

When VS/COBOL II was introduced, WS was allocated via a CICS GETMAIN (without an INITIMG keyword), so without any type of initialization, SUB6 could contain any value. OS/VS COBOL WS was allocated via an MVS GETMAIN and it was pre-initialized.

But, the VALUE clause associated with SUB6, should clear this field to X'0000'.

If there wasn't a VALUE clause, then (for example) SUB6 could contain X'4040' (spaces), which is decimal 16448.

Once a CICS task is terminated, WS field-values which had been altered are no longer valid. This is also true for sub-programs which had been accessed via a LINK-API after returning back to the LINKER.

Bill
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Mon Sep 27, 2010 10:56 pm
Reply with quote

Earl,
It is in production which means it is still working.
code runs for thousands of lines. do you want me to copy it?

What I am asking is,
Is there some other way to put value into the variable other than a move and commarea?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 27, 2010 10:56 pm
Reply with quote

Hello,

SUB6 starts at zero.

The code increments by 1. . .

I suspect that after some times thru (maybe 10) the value will the next time be > 10. . .

Why is this a problem. . . icon_confused.gif

Obviously, i am missing something. . .
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Mon Sep 27, 2010 11:01 pm
Reply with quote

Thanks for the effort Bill & dick.
I will look into it. I will post if i find what it is.
thanks again.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 27, 2010 11:32 pm
Reply with quote

Hello,

Quote:
Is there some other way to put value into the variable other than a move and commarea?
Sure - unless the compute is being considered a "move".

No, it is not a good idea to try to post thousands of lines of code.

I guess i still don't understand the problem icon_confused.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Sep 28, 2010 12:44 am
Reply with quote

Shan,
go to the REFERENCE NAME cross-reference portion of the compile output,
if you don't have it,
VIEW the program (with all procedural copybooks expanded) and on command line:
x all;f all sub6

that will tell you which statements reference the sub6 variable.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Sep 28, 2010 12:59 am
Reply with quote

Is the code in question even being executed?
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 -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top