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

Query in using table.


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

Active User


Joined: 14 Sep 2009
Posts: 184
Location: Coimbatore

PostPosted: Mon Apr 05, 2010 3:27 pm
Reply with quote

hi,

I have a table like,
Code:
05  A07SRCEU-COMNT-CODE-TBL.                               
    10  A07SRCEU-VARIABLE-CODES  OCCURS  0  TO  153  TIMES 
                          DEPENDING  ON  A07SRCEU-CODE-CNT.
                                                           
        15  A07SRCEU-COMNT-TYPE          PIC X(01).         
                                                           
        15  A07SRCEU-COMNT-CODE          PIC S9(03)  COMP-3.
            88  MISSING-COMNT-CODE-A07SRCEU    VALUE  +999.


Can i use the above table as:

Code:
MOVE A07SRCEU-COMNT-CODE-TBL(1:81)    TO           
                        WS-A07SRCEU-PHYSICAL-X.   
MOVE A07SRCEU-COMNT-CODE-TBL(82:213)  TO           
                        WS-A07SRCEU-TOXICOLOGY-X. 
MOVE A07SRCEU-COMNT-CODE-TBL(295:39)  TO           
                        WS-A07SRCEU-ENV-X.         
MOVE A07SRCEU-COMNT-CODE-TBL(334:126) TO           
                        WS-A07SRCEU-SAFETY-X.     

and move it to a working storage variable.????

As I am writing a new program from scratch, I dint compile it yet. So Please let me know.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon Apr 05, 2010 3:58 pm
Reply with quote

The code you provide would only work if 153 occurrences are defined for the table. If there are not 153 occurrences, I believe the MOVE results will be unpredictable (in IBM terminology). You would be wise to verify the occurrence count BEFORE starting your move statements.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Apr 05, 2010 5:00 pm
Reply with quote

why not redefine the table into it supposed parts?
would make it easier for someone to follow the code and maintain it,
after you get fired for coding such garbage.

this is really unnecessary use of Reference Modification?

what you are implying is that the first 17 items are toxicology
and the next x (i am not going to bother to calculate this) items are something else and so on.

as Robert said, this only holds true if you have 153 items.

and how do you load the table. how do you insure that the first 7 items are only populated with toxicology items?

I think you have a more basic problem than determining if your BS Reference Modification works - which it will, it will move data from one address to another. whether this is valid for the application, I have no idea - don't think you do either.
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 Apr 05, 2010 8:39 pm
Reply with quote

Hello,

Now that you have stumbled onto reference modification, suggest you put it on a shelf and properly implement code to meet the requirement.

This needs to be code that is easily understood as to the business fuction it supports - not some techno-babble.

Just because something exists does not make it a good candidate for use in "real" code. None of the sites i support would permit this to be promoted to Production - it is simply unacceptable. . .
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Apr 06, 2010 3:39 am
Reply with quote

abdulrafi wrote:
As I am writing a new program from scratch

For a new program, you should be able to write better code, as clearly stated in other responses to your question.
  1. In this case, definitely discard the idea of reference modification.
  2. You should really check how this OCCURS DEPENDING ON affects the 4 different topics (PHYSICAL, TOXICOLOGY, ENV and SAFETY).
  3. Tell us more about this array. Is it your input or your output ?
    Do you need to access each occurrence of each topic separately ?
    Once a topic is in its own area, what do you do with it ?
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 Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts RC query -Time column CA Products 3
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top