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

Doubts related to insertion of table values


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

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Tue Apr 24, 2012 11:54 am
Reply with quote

Hi,

Please find below code:

Code:
PARA-ABCD.
  PERFORM PARA1
  PERFORM PARA2.


PARA1.
 PERFORM PARA3
 IF A<=B
  PERFORM POPULATE-TABLE1-PARA
  PERFORM INSERT-TABLE1-PARA
END-IF.


PARA2.
 PERFORM PARA4
IF A<=B
  PERFORM POPULATE-TABLE1-PARA
  PERFORM INSERT-TABLE1-PARA
END-IF.


POPULATE-TABLE1-PARA.
 INITIALISE TABLE1
 MOVE WS-VARIABLES TO TABLE-DECLGEN-FIELDS.


INSERT-TABLE1-PARA.
 IN THESE PARA INSERT STATEMENT IS PRESENT.



I have above logic in my program from buisness point of view.So i am unable to understand as in table two times insert is done so will it append the table values second time while doing insertion or due to intialise verb will it insert new values in table from paraB when both paraA and paraB will get perfromed for A<=B condition.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 24, 2012 12:11 pm
Reply with quote

I'm not sure I understand the question.

The INITIALIZE is doing nothing other than setting the values of items to which it applies to zero or space depending on whether they are numeric or alphanumeric. It is not doing anything else.

If A is not greather than B, then

Code:
PARA3
POPULATE-TABLE1-PARA
INSERT-TABLE1-PARA
PARA4
POPULATE-TABLE1-PARA
INSERT-TABLE1-PARA


Will all be performed, unless there is any code in any of the paragraphs which changes the value of either A, B or both, in which case different things will happen.

But, on the fact of it, INSERT-TABLE1-PARA will be performed twice. What happens depends on the code in that paragraph.

Can you show the contents of TABLE1 and the MOVEs which follow the INITIALIZE?
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top