Back in the mid 70's, I had a FORTRAN programmer working with my on a COBOL project. In FORTRAN, variable names at that time were limited to six characters and those that began with the letters I-N were integers unless you specifically defined them to be otherwise, so she had elected to name...
Of course, this will only work when the values are left justified and contain legitimate numbers, but it's short:
01 DOLLAR-VALUE PIC 9(5)V99.
01 WORK-FIELD PIC Z(5).99.
01 REDEFINES WORK-FIELD.
05 INTEGER-PORTION PIC X(5) JUST RIGHT.
05 DECIMAL-POINT PIC X...
Since you requested a snippet, I thought you might appreciate this, it's relatively short:
In WORKING-STORAGE:
01 REQUIRED-VARIABLES.
05 NUMBER-TO-PARSE PIC X(20).
05 SIGN-CHAR PIC X.
88 NUMBER-IS-NEGATIVE VALUE "-".
05 INTEGER-CHARS PIC X(18) JUST RIGHT.
05...
I believe that you will still need to use pointers, because the arguments are defined as pointers. To create a pointer, code something like this:
01 LNK-MODULE-NAME-PTR USAGE POINTER.
then you should be able to fill it in the PROCEDURE DIVISION with this code:
SET...
I always tell my students that you should write your code for the benefit of the next programmer, because more often than not the next programmer is you. (:I Betty Scherber
Brainbench MVP for COBOL II
http://www.brainbench.com
It is difficult for us to tell whether you are getting the redefines and the procedure division wrong, because you have not shown us your code. #-) Betty Scherber
Brainbench MVP for COBOL II
http://www.brainbench.com
Speaking of the vendor being happy to fix things, I used to be on the COBOL compiler team at NCR. At the request of a customer, we fixed LINAGE, which wasn't working according to the ANS specification. This annoyed everyone whohad previously figured out what it was actually doing and used it...
I've seen a couple of compilers that will accept this, but recommend you avoid coding OCCURS on the 01, because it is not standard, and therefore not portable. Betty Scherber
Brainbench MVP for COBOL II
http://www.brainbench.com
This is not terribly efficient, but it's guaranteed to work, even without restructuring the file. CLOSE the file and re-OPEN it after the WRITE. Betty Scherber
Brainbench MVP for COBOL II
http://www.brainbench.com
Actually, COMP is more often BINARY than PACKED-DECIMAL, though, of course, there is no standard, and in BINARY the ZERO is indeed LOW-VALUES.
Betty Scherber
Brainbench MVP for COBOL II
http://www.brainbench.com
Fabio -
You may or may not get the format you want, depending on who is interpretting your instructions. Providing the person with examples, may help, but I have found it often doesn't. Some of these "newfangled" tools just don't handle numeric formats the same as good old COBOL...
CEH4702:
Actually, END-SEARCH is not an IBM extension. It is standard ANS-COBOL beginning in COBOL-85.
Betty Scherber
Brainbench MVP for COBOL II
http://www.brainbench.com
This is not so much a question of compiler, as a question of printer. Most printers have some sort of control sequence you can send to accomplish this. You simply have to intermingle the control sequence(s) with your text to be printed. You can switch your fonts back and forth at will to...
Chitownjoe -
Your problem is with your INSPECT statements; specifically, you want an INSPECT CONVERTING not an INSPECT REPLACING. The CONVERTING replaces any occurrence of any character from the first string with the character in the same position in the second string. The REPLACING...
Thanks, Ronald -
It was a lot more fun to write and debug than a plain old bubble-sort program. Of course, I did wind up having to put in a big delay-loop to slow it down enough so we humans could watch it happening. Betty Scherber
Brainbench MVP for COBOL II
http://www.brainbench.com
If IBM is equating arrays w/tables, why are we arguing?
For the same reason that we argue with things said by that big company in Redmond. Just because you have more money doesn't make you right. Betty Scherber
Brainbench MVP for COBOL II
http://www.brainbench.com
As an old COBOL programmer wanting to learn new tricks, I once took a Visual Basic class. One of our assignments was to write any program that used a "Bubble Sort". Having implemented the algorithm in many different languages over the years, I found a way to make it interesting...
Slade-
Actually Saginaw's definition is the ANS standard and yours is an IBM extension.
In any case, according to ANS COBOL the 9x file status is implementor defined and it is up to the individual implementor what character they use for the second position. I've seen lots of different...
The COBOL language comes in modules. To qualify as a COBOL compiler at some specific level, you must pass tests which determine whether you have implemented the module at the low or high level. The module which handles multiply occurring data items is called the Table Handling Module - don't...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.