Subject: | |
From: | |
Reply To: | |
Date: | Thu, 30 Nov 1995 21:55:19 GMT |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
I ran across a problem where I am moving from a PIC 9 field that has
spaces in it to a PIC 9 field.
I would have expected the program to leave the source field alone and put
zeros in the receiving field (rather than issuing an Illegal ASCII
message). What actually happens is both fields end up with zeros. The
following program is a simple example.
Am I incorrect in my assumption that the from field in a MOVE statment
should never be modified by the MOVE? It appears the compiler is fixing
up the source field before doing the move rather than fixing it on the
way over.
Open ZEROTEST.S.DEVELOP List * = 4.2 Margins = 7/72
1 $CONTROL USLINIT ,SYMDEBUG
1.1 IDENTIFICATION DIVISION.
1.2 PROGRAM-ID. COBPROG.
1.3 AUTHOR. MARK ROBERTS, TECHNALYSIS.
1.5 DATE-WRITTEN. NOV 1995.
1.6 DATE-COMPILED.
1.7 ENVIRONMENT DIVISION.
1.8 CONFIGURATION SECTION.
1.9 SOURCE-COMPUTER. HP3000.
2 OBJECT-COMPUTER. HP3000.
2.1 SPECIAL-NAMES.
2.2 CONDITION-CODE IS CONDITION-CD.
2.3
2.4
2.5 $PAGE "DATA DIVISION / WORKING-STORAGE SECTION"
2.6 DATA DIVISION.
2.7
2.8 WORKING-STORAGE SECTION.
2.9
3 01 FROM-FIELD-X.
3.1 05 FROM-FIELD-9 PIC 9(4).
3.2 01 TO-FIELD-X.
3.3 05 TO-FIELD-9 PIC 9(4).
4.1
4.2 $PAGE "PROCEDURE DIVISION "
4.3 PROCEDURE DIVISION.
4.4
4.5 00000-MAIN-CONTROL SECTION 00.
4.6
4.7 MOVE SPACES TO FROM-FIELD-X.
4.8 MOVE FROM-FIELD-9 TO TO-FIELD-9.
4.9 DISPLAY FROM-FIELD-X.
5 STOP RUN.
5.1
6.3
QEDIT:DEVELOP/RUN ZEROTEST.X
0000
End Run
--
Regards, Phone: 612-736-0536
Mark Roberts Reply: [log in to unmask]
"Opinions expressed herein are my own and do not necessarily represent
those of 3M."
Opinions expressed herein are my own and may not represent those of 3M.
|
|
|