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

IGYDS1267-S, IGYGR1478-E


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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue May 24, 2011 6:55 pm
Reply with quote

please avoid using local jargon or Your own language
since we take time to understand Your problem it would be nice on Your side to spare us the trouble of understanding and translating Your language
( crores, laks, and friends )

almost time to lock the topic, looks like it is going nowhere and is just wasting everybody' s time icon_biggrin.gif
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: Tue May 24, 2011 7:06 pm
Reply with quote

Enrico,

Does this mean I need to stop using using the "FWORD"? icon_smile.gif

Bill
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue May 24, 2011 7:13 pm
Reply with quote

Naah !

IIRC the FWORD has been a standard term in IT jargon for a loong time icon_biggrin.gif
( HWORD, FWORD, DWORD, ... )
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue May 24, 2011 7:17 pm
Reply with quote

enrico-sorichetti wrote:
Naah !

IIRC the FWORD has been a standard term in IT jargon for a loong time icon_biggrin.gif
( HWORD, FWORD, DWORD, ... )

I've never heard a colleague use "fnord". Of course, I wouldn't icon_wink.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue May 24, 2011 9:13 pm
Reply with quote

Why not just run SUPERC or COMPAREX if you have that installed?
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: Wed May 25, 2011 2:47 pm
Reply with quote

Bill O'Boyle wrote:
To avoid going beyond an array HIBOUNDS, calculate this array-max up front in HOUSEKEEPING and use this max as your HIBOUNDS throughout the code. It will always be correct, regardless of the OCCURS.

Example -

Code:

03  WS-FWORD           PIC 9(08) COMP.
03  WS-ARRAY-REC.
    05  WS-ARRAY-ENTRY OCCURS 100 TIMES
                       INDEXED BY X-WS-AE, X-WS-AE-MAX
                       PIC  X(256).

DIVIDE LENGTH OF WS-ARRAY-REC BY LENGTH OF WS-ARRAY-ENTRY (1)
                       GIVING WS-FWORD.

SET  X-WS-AE-MAX       TO WS-FWORD.

Hard coding array-max's are for the birds....

Bill


This is nice.

However, I'd like to have-my-cake-and-eat-it by also having the hard-coded max (maybe a "seed cake", for the birds).

Reason is, when someone comes along with the intention of changing the table, extending the occurs, and what they do is... just change the array-max... It would actually be nice if Cobol let you do that, or to get the max from the OCCURS clause, but it doesn't. Now, with your idea Bill, maybe we can cover that as well.

Code:

03  WS-ARRAY-MAX     PIC 9(08) COMP VALUE 100.
03  WS-FWORD           PIC 9(08) COMP.
03  WS-ARRAY-REC.
    05  WS-ARRAY-ENTRY OCCURS 100 TIMES
                       INDEXED BY X-WS-AE, X-WS-AE-MAX
                       PIC  X(256).

DIVIDE LENGTH OF WS-ARRAY-REC BY LENGTH OF WS-ARRAY-ENTRY (1)
                       GIVING WS-FWORD.

IF WS-FWORD NOT EQUAL TO WS-ARRAY-MAX
      report and gracefully collapse
END-IF

SET  X-WS-AE-MAX       TO WS-FWORD.


I know it might seem redundant, but it catches those times that the OCCURS should have been changed, but was not, and the max was.
Back to top
View user's profile Send private message
kunal jain

New User


Joined: 19 May 2011
Posts: 59
Location: India

PostPosted: Wed May 25, 2011 3:12 pm
Reply with quote

Thank you all for your advice and suggestion.

I have got the clue of what can be the path to my solution.
I am very pleased to receive in-depth analysis and suggestion to my problem.

Thank you so much.. icon_lol.gif
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 Goto page Previous  1, 2

 


Search our Forums:

Back to Top