MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

special register

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
ds390
Beginner


Joined: 23 Jan 2007
Posts: 82
Topics: 39

PostPosted: Fri Jun 15, 2007 10:45 pm    Post subject: special register Reply with quote

why doesn't cobol use special registers to replays all funcitons?
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Sat Jun 16, 2007 12:42 am    Post subject: Reply with quote

ds390,

Can you please post your question with more explanation ?
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Sat Jun 16, 2007 5:55 am    Post subject: Reply with quote

shekar123,

try reading phonetically.

ds390,

Special registers are reserved words that name storage areas generated by the compiler. Their primary use is to store information produced through specific COBOL features. Each such storage area has a fixed name, and must not be further defined within the program. The special registers are:

* ADDRESS OF
* DB-FORMAT-NAME
* DEBUG-ITEM
* FORMAT OF
* LENGTH OF
* LINAGE-COUNTER
* LOCALE OF
* RETURN-CODE
* SORT-RETURN
* WHEN-COMPILED
* XML-CODE
* XML-EVENT
* XML-NTEXT
* XML-TEXT

Functions are built-in procedures or subroutines used to evaluate, make calculations on, or transform data

Functions are CALLable from multiple languages. There is no limit to the number, type of functions an operating system/environment can have.

In COBOL if you replaced all functions with special regiisters, you would further isolate COBOL from the other programming languages, as well as place a tremendous load on the COBOL compiler to maintain all the reserved words (special registers).

Also, by definition special registers are not function equivalents.

that's my opinion based on excerpts of IBM documentation.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
ds390
Beginner


Joined: 23 Jan 2007
Posts: 82
Topics: 39

PostPosted: Sat Jun 16, 2007 10:21 pm    Post subject: Reply with quote

Thanks. Fucntions can replace special registers then, I guess?
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Sun Jun 17, 2007 3:30 am    Post subject: Reply with quote

ds390,

It is not a matter of replacing. If a function provides the same value as a special register, they can be considered interchangeable.

Some special registers do not have a function equivalent, e.g. ADDRESS OF, RETURN-CODE, SORT-RETURN, WHEN-COMPILED.

Special register LENGTH OF and the LENGTH function return the same results.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
ds390
Beginner


Joined: 23 Jan 2007
Posts: 82
Topics: 39

PostPosted: Sun Jun 17, 2007 2:56 pm    Post subject: Reply with quote

Do special registers have anything to do with the physical processer's registers? Or like as I remember in C, you can save a variable into the register area, which have a limit of 8 or 16 on the numbers you can use.

I am new to all this. The naming of "special register" really confuses me.

Thank you for your patience on this.
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Sun Jun 17, 2007 5:30 pm    Post subject: Reply with quote

No, in COBOL they are hardware independent. They are basically predefined names for certain common data values available to COBOL and often needed by the application program.
Think of this, if you want the file status for a file operation, you must define the name and area of where COBOL will put that status in your SELECT. SORT-RETURN is a data area where the internal SORT will put its status without you needing to define the name or the area in working storage.
Back to top
View user's profile Send private message
ds390
Beginner


Joined: 23 Jan 2007
Posts: 82
Topics: 39

PostPosted: Mon Jun 18, 2007 8:38 pm    Post subject: Reply with quote

Thanks! You guys are very helpful!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group