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
 

 

Query in using table.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 141
Location: Coimbatore

PostPosted: Mon Apr 05, 2010 3:27 pm    Post subject: Query in using table.
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: 7993
Location: Bellevue, IA

PostPosted: Mon Apr 05, 2010 3:58 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Apr 05, 2010 8:39 pm    Post subject:
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: 1226
Location: Israel

PostPosted: Tue Apr 06, 2010 3:39 am    Post subject: Re: Query in using table.
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    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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm


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