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

Declaring at Group level is better or elementary ?


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

New User


Joined: 16 Aug 2007
Posts: 14
Location: INDIA

PostPosted: Tue Sep 18, 2007 2:20 pm
Reply with quote

Here is a small situation and I would like to know which one will work better and what's the advantage of using it that way.

A file is having only one field say :

REQUEST-ID PIC S9(09) COMP.

So, while declaring in the FILE SECTION, which of the ways below is preferred:

FD REQUEST-ID-FILE
RECORDING MODE IS F
LABEL RECORDS ARE STANDARD.

a)
01 REQUEST-ID-REC.
05 REQUEST-ID PIC S9(09) COMP.

OR

b)
01 05 REQUEST-ID PIC S9(09) COMP.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Sep 18, 2007 2:29 pm
Reply with quote

Nayanish,

Both has same effect.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Tue Sep 18, 2007 2:32 pm
Reply with quote

Hi,

Group variable is always alphanumeric. If you have some operations to do related to alphanumeric, first one is preferable.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Sep 18, 2007 2:36 pm
Reply with quote

Quote:
01 05 REQUEST-ID PIC S9(09) COMP.
Assuming the extra "05" is a typo, either would work....
Quote:
Group variable is always alphanumeric.
Yes, but 01 levels can be elementary items too....
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Sep 18, 2007 3:06 pm
Reply with quote

I would say the situation posted does not make any practical sence. I've never seen a file declared for just one variable. If there are many variables then we have to use group variables.
Rest I agree with all others that if only one variable is there then there is no advantage as such in either way.. icon_smile.gif
Back to top
View user's profile Send private message
nayanishpatil

New User


Joined: 16 Aug 2007
Posts: 14
Location: INDIA

PostPosted: Tue Sep 18, 2007 3:20 pm
Reply with quote

I think that the post requires opinions on which option would work better and advantages of the same.

There is not need to comment on what sense it makes to any individual for that matter. And for your kind information, this situation has been used in one of the programs which we are using for the client and had caused a samll variation in output.

So, it's better to address the query rather than other comments.

_____________________
Back to top
View user's profile Send private message
kgumraj2

New User


Joined: 01 Aug 2007
Posts: 42
Location: Hyderabad

PostPosted: Tue Sep 18, 2007 3:39 pm
Reply with quote

nayanishpatil,

Quote:
There is not need to comment on what sense it makes to any individual for that matter. And for your kind information, this situation has been used in one of the programs which we are using for the client and had caused a samll variation in output.


I absoultly aggree with you.

Regarding query,
When I ran it was giving the compiler error.
and second condition will not work, go with first.
Code:

            01                                                     
                                                                   
IGYDS1089-S "01" was invalid.  Scanning was resumed at the next area
            level-number, or the start of the next clause.         
                                                                   
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Sep 18, 2007 3:56 pm
Reply with quote

nayanishpatil wrote:
I think that the post requires opinions on which option would work better and advantages of the same.

There is not need to comment on what sense it makes to any individual for that matter. And for your kind information, this situation has been used in one of the programs which we are using for the client and had caused a samll variation in output.

So, it's better to address the query rather than other comments.

_____________________

Did I say anything wrong so that you became angry?
I did not say that it doesn't make any sence but any 'Practical or Business' sence. If it makes sense to your business then I don't have any problem. And I did address your query..
Also i would like to know about 'small variation' caused in o/p in more details..
Kumarj2,
Did you remove 05 after 01 which OP has posted wrongly?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Sep 18, 2007 4:01 pm
Reply with quote

agkshirsagar wrote:
Also i would like to know about 'small variation' caused in o/p in more details..
I also would lke to know.....
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Sep 18, 2007 4:10 pm
Reply with quote

CICS Guy wrote:
agkshirsagar wrote:
Also i would like to know about 'small variation' caused in o/p in more details..
I also would lke to know.....

I doubt we will get that..
maybe OP is busy typing even more ferocious response.. icon_lol.gif
I still don't get what must have offended him, I got 2 votes against me here.. icon_cry.gif
Back to top
View user's profile Send private message
nayanishpatil

New User


Joined: 16 Aug 2007
Posts: 14
Location: INDIA

PostPosted: Tue Sep 18, 2007 4:11 pm
Reply with quote

It's not about being angry nor I am angry.

I have just brought out to the fore that in case of any queries, such comments are not required. You just address the query and avoid any such comments. icon_neutral.gif

Let me elaborate the "small variation in output".

Assumption:1)The input file is having 16 records.
2)The program is having an SQL query which updates record
matching to the record from the input file.
3) 01 REQUEST-ID PIC S9(09) COMP. is used to declare.

When a JCL prepared for the pgm is run, it finds all the 16 records and even goes fine inside the query. But once all the records are read and the file approaches it's end, it reads a non-existing 17th records and while going in the updation query, the same is not present in the table and hence abends.

But when the same pgm with a group level declaration is used works fine.
Back to top
View user's profile Send private message
kgumraj2

New User


Joined: 01 Aug 2007
Posts: 42
Location: Hyderabad

PostPosted: Tue Sep 18, 2007 4:12 pm
Reply with quote

Quote:
Kumarj2,
Did you remove 05 after 01 which OP has posted wrongly?


I havent,
Please check

Code:
            01                                                     
                                                                   
IGYDS1089-S "01" was invalid.  Scanning was resumed at the next area
            level-number, or the start of the next clause.         
                                                                   
               10 INFILE-RECORD           PIC X(3119).             
Back to top
View user's profile Send private message
kgumraj2

New User


Joined: 01 Aug 2007
Posts: 42
Location: Hyderabad

PostPosted: Tue Sep 18, 2007 4:14 pm
Reply with quote

Sorry to not mention,
This is in the FD level only;
Thanks
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Sep 18, 2007 4:22 pm
Reply with quote

Quote:
it reads a non-existing 17th records

may be the problem is something different .. Would you like to post your logic which checks 'EOF' condition for file and read loop?

kumarj,
Code:
a)
01 REQUEST-ID-REC.
05 REQUEST-ID PIC S9(09) COMP.

OR

b)
01 REQUEST-ID PIC S9(09) COMP.


both should compile correctly, please recheck what you have coded..
Back to top
View user's profile Send private message
nayanishpatil

New User


Joined: 16 Aug 2007
Posts: 14
Location: INDIA

PostPosted: Tue Sep 18, 2007 4:29 pm
Reply with quote

It's not about being angry nor I am angry.

I have just brought out to the fore that in case of any queries, such comments are not required. You just address the query and avoid any such comments. icon_neutral.gif

Let me elaborate the "small variation in output".

Assumption:1)The input file is having 16 records.
2)The program is having an SQL query which updates record
matching to the record from the input file.
3) 01 REQUEST-ID PIC S9(09) COMP. is used to declare.

When a JCL prepared for the pgm is run, it finds all the 16 records and even goes fine inside the query. But once all the records are read and the file approaches it's end, it reads a non-existing 17th records and while going in the updation query, the same is not present in the table and hence abends.

But when the same pgm with a group level declaration is used works fine.

And in both the cases there are no compilation errors. Its an error free code.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Sep 18, 2007 4:35 pm
Reply with quote

Sounds more like a programming bug to me.....
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 How to load to DB2 with column level ... DB2 6
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Splitting group records based on deta... DFSORT/ICETOOL 8
Search our Forums:

Back to Top