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
 

 

How to eliminate GO TO

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

New User


Joined: 26 Nov 2010
Posts: 30
Location: Hyderabad

PostPosted: Mon Sep 19, 2011 5:40 pm    Post subject: How to eliminate GO TO
Reply with quote

Code:
IF  WS0Z-CCYYWK NOT      <  WS0Z-CCYYLW                     
         AND WS0Z-CCYYWK NOT  >  WS0Z-CCYYHI                     
*----->       DATE IS NOW WITHIN WINDOW                           
*----->       OVERLAY CENTURY VALUE.                             
             MOVE WS0Z-CENTWK TO DAT73C DAT83C DAT61C DATCTY     
     DAT23C                                                       
             GO TO F8120-Z.                                       
*----->       * ADD 200 FOR NEXT CENTURY                         
     ADD 200 TO WS0Z-CCYYWK.                                     
     IF  WS0Z-CCYYWK NOT      <  WS0Z-CCYYLW                     
         AND WS0Z-CCYYWK NOT  >  WS0Z-CCYYHI                     
*----->       DATE IS NOW WITHIN WINDOW                           
*----->       OVERLAY CENTURY VALUE.                             
             MOVE WS0Z-CENTWK TO DAT73C DAT83C DAT61C DATCTY     
     DAT23C                                                       
             GO TO F8120-Z.                                       
 F8120-Z.                                                         
     EXIT.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Mon Sep 19, 2011 6:03 pm    Post subject: Reply to: How to eliminate GO TO
Reply with quote

As well as tagging-on to the end of an old topic, you seem to have forgotten to include an actual question.

Edit: and code tags...
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Sep 19, 2011 6:14 pm    Post subject:
Reply with quote

as well as use CODE tags.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Mon Sep 19, 2011 6:19 pm    Post subject: Re: How to eliminate GO TO
Reply with quote

Code:
IF ( WS0Z-CCYYWK NOT      <  WS0Z-CCYYLW )
         AND ( WS0Z-CCYYWK NOT  >  WS0Z-CCYYHI )               
*----->       DATE IS NOW WITHIN WINDOW                           
*----->       OVERLAY CENTURY VALUE.                             
             MOVE WS0Z-CENTWK TO DAT73C DAT83C DAT61C DATCTY     
     DAT23C                                                       
ELSE
*----->       * ADD 200 FOR NEXT CENTURY                         
     ADD 200 TO WS0Z-CCYYWK
     IF  ( WS0Z-CCYYWK NOT      <  WS0Z-CCYYLW )                 
         AND ( WS0Z-CCYYWK NOT  >  WS0Z-CCYYHI )
*----->       DATE IS NOW WITHIN WINDOW                           
*----->       OVERLAY CENTURY VALUE.                             
             MOVE WS0Z-CENTWK TO DAT73C DAT83C DAT61C DATCTY     
     DAT23C                                                       
             END-IF
END-IF
.
 F8120-Z.                                                         
     EXIT.


Could be something like what you want.

Don't like the data-names, don't like the style/content of the comments, but such is life.

You are repeating a test, have LT & GT on same test (are you deliberately ignoring EQ?). So you could restructure the whole thing, if that is your question. You could.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Mon Sep 19, 2011 6:51 pm    Post subject: Reply to: How to eliminate GO TO
Reply with quote

this is one of the cases where a GOTO is acceptable,
if You indent for readability, AND YOU HAVE A few more IFs
the IF ELSE END_IF will indent too much
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Mon Sep 19, 2011 8:43 pm    Post subject: Re: How to eliminate GO TO
Reply with quote

The code can be made more maintainable and self-documenting.


Code:

PERFORM XX-PROCESS-IN-DATE-WINDOW
ADD A-VALUE-OF-200-WHICH-MEANS-SOMETHING TO WS0Z-CCYYWK.                                     
PERFORM XX-PROCESS-IN-DATE-WINDOW

F8120-Z.                                                         
     EXIT.
XX-PROCESS-IN-DATE-WINDOW SECTION.

IF  ( WS0Z-CCYYWK NOT  <  WS0Z-CCYYLW )                     
AND ( WS0Z-CCYYWK NOT  >  WS0Z-CCYYHI )
         MOVE WS0Z-CENTWK                  TO DAT73C
                                              DAT83C
                                              DAT61C
                                              DATCTY     
                                              DAT23C                           
END-IF
.
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 how to eliminate records from operati... PUMA DFSORT/ICETOOL 5 Tue Dec 23, 2014 4:42 pm
No new posts How to eliminate duplicate records - ... Rohan saldanha DFSORT/ICETOOL 7 Tue Jul 15, 2014 7:35 pm
No new posts How to eliminate unwanted record in t... nkothako DFSORT/ICETOOL 3 Sat Jan 18, 2014 12:24 am
No new posts Eliminate last occurence in a record sun_job JCL & VSAM 10 Wed Jul 03, 2013 11:42 pm
No new posts Eliminate duplicates based on multipl... Bill Woodger DFSORT/ICETOOL 2 Thu Feb 28, 2013 12:58 pm


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