View previous topic :: View next topic |
Author |
Message |
ds390 Beginner
Joined: 23 Jan 2007 Posts: 82 Topics: 39
|
Posted: Fri Jun 15, 2007 10:45 pm Post subject: special register |
|
|
why doesn't cobol use special registers to replays all funcitons? |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Sat Jun 16, 2007 12:42 am Post subject: |
|
|
ds390,
Can you please post your question with more explanation ? _________________ Shekar
Grow Technically |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Sat Jun 16, 2007 5:55 am Post subject: |
|
|
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 |
|
|
ds390 Beginner
Joined: 23 Jan 2007 Posts: 82 Topics: 39
|
Posted: Sat Jun 16, 2007 10:21 pm Post subject: |
|
|
Thanks. Fucntions can replace special registers then, I guess? |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Sun Jun 17, 2007 3:30 am Post subject: |
|
|
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 |
|
|
ds390 Beginner
Joined: 23 Jan 2007 Posts: 82 Topics: 39
|
Posted: Sun Jun 17, 2007 2:56 pm Post subject: |
|
|
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 |
|
|
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Sun Jun 17, 2007 5:30 pm Post subject: |
|
|
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 |
|
|
ds390 Beginner
Joined: 23 Jan 2007 Posts: 82 Topics: 39
|
Posted: Mon Jun 18, 2007 8:38 pm Post subject: |
|
|
Thanks! You guys are very helpful! |
|
Back to top |
|
|
|
|