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

Difference Between "OCCURS N TIMES PIC X" and &quo


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

New User


Joined: 10 Mar 2009
Posts: 16
Location: Hyderabad

PostPosted: Tue Jul 14, 2009 11:29 am
Reply with quote

Hi!

1) what is the difference between "FILLER OCCURS N TIMES PIC X" AND "FILLER PIC X(N)"

2)If there is a difference which is the best in performance wise and how?
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Jul 14, 2009 11:51 am
Reply with quote

Hi Raj,

As per my knowledge i dont think there is any difference though i would prefer the second one as its simpler... icon_razz.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jul 14, 2009 12:49 pm
Reply with quote

Quote:
which is the best in performance wise and how


performance of what?
Back to top
View user's profile Send private message
Maddipatla Rajasekhar

New User


Joined: 10 Mar 2009
Posts: 16
Location: Hyderabad

PostPosted: Tue Jul 14, 2009 1:20 pm
Reply with quote

Performance in terms of processing time
Back to top
View user's profile Send private message
Maddipatla Rajasekhar

New User


Joined: 10 Mar 2009
Posts: 16
Location: Hyderabad

PostPosted: Tue Jul 14, 2009 1:29 pm
Reply with quote

Hi Binop,

Thanks for ur reply.. icon_smile.gif

Just now i get the answer for my query thru my analysis, the diff is that if we code "filler occurs n times pic x" then 'n' single byte fields will be allocated individually with field name 'filler' every time, if we code pic x(n) then continuous n bytes will be allocated with single field name filler.
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: Tue Jul 14, 2009 3:12 pm
Reply with quote

Performance will be the same in either case -- FILLER items are defined at compile time; they're not used at run-time since they, by definition, do not contain data that your program can reference.

You might eat up a small fraction more time during the compile if you have lots and lots of FILLER OCCURS clauses, but once the compile is done the executing code is what matters.
Back to top
View user's profile Send private message
Maddipatla Rajasekhar

New User


Joined: 10 Mar 2009
Posts: 16
Location: Hyderabad

PostPosted: Tue Jul 14, 2009 3:25 pm
Reply with quote

Hi Donald,

Thank you so much for ur answer.. icon_smile.gif
Back to top
View user's profile Send private message
Thangaprabhu

New User


Joined: 15 Jul 2009
Posts: 16
Location: INDIA

PostPosted: Fri Jul 17, 2009 6:46 pm
Reply with quote

The major difference is
there are two fields
FIELD1 declared as occurs n times PIC X
FIELD2 declared as PIC X(N).

if u want to find the Nth element in FIELD1 u should use subscripts
eg:- DISPLAY FIELD1(N) will display Nth element
if u want to find the Nth element in FIELD2 u should use Reference modification
eg:- DISPLAY FIELD2(N:1) will display Nth element
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Fri Jul 17, 2009 6:49 pm
Reply with quote

Also its costly to initialize FIELD1.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jul 17, 2009 8:03 pm
Reply with quote

Thangaprabhu wrote:
u should use subscripts


the effecient method is by indexing.
subscripts are slower than indexing.
PIC s9(n) or pic 9(n)
is not as effecient as pic s9(n) comp.
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 PuTTY - "User is not a surrogate... IBM Tools 5
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts Timestamp difference and its average ... DB2 11
No new posts Newbie Stuck on "Duplicate Datas... TSO/ISPF 5
No new posts Difference when accessing dataset in ... JCL & VSAM 7
Search our Forums:

Back to Top