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
 

 

Declaring at Group level is better or elementary ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Declaring at Group level is better or elementary ?
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: 1439
Location: Bangalore,India

PostPosted: Tue Sep 18, 2007 2:29 pm    Post subject:
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: 356
Location: New York

PostPosted: Tue Sep 18, 2007 2:32 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Tue Sep 18, 2007 2:36 pm    Post subject:
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: 685
Location: Earth

PostPosted: Tue Sep 18, 2007 3:06 pm    Post subject:
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    Post subject:
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    Post subject:
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: 685
Location: Earth

PostPosted: Tue Sep 18, 2007 3:56 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Tue Sep 18, 2007 4:01 pm    Post subject:
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: 685
Location: Earth

PostPosted: Tue Sep 18, 2007 4:10 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 685
Location: Earth

PostPosted: Tue Sep 18, 2007 4:22 pm    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Tue Sep 18, 2007 4:35 pm    Post subject:
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    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 abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Select first 2 group data vice_versa DFSORT/ICETOOL 10 Mon Jun 13, 2016 2:21 pm
No new posts Syncsort TPF Level Majid Hussain SYNCSORT 2 Wed Apr 13, 2016 2:22 am
No new posts Hookup group of records in multiple p... V S Amarendra Reddy DFSORT/ICETOOL 3 Thu Feb 18, 2016 11:49 pm


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