|
Thanks Geir, Regards Roman <Geir.Kildal@xxxxxxxxxxxxxxx> Sent by: cobol400-l-bounces@xxxxxxxxxxxx 16.10.2006 13:55 Please respond to COBOL Programming on the iSeries/AS400 <cobol400-l@xxxxxxxxxxxx> To <cobol400-l@xxxxxxxxxxxx> cc Subject Re: [COBOL400-L] Moving SPACES in numerical fields Hi Miklas: Here is the reason why: If you move space to a numeric field in COBOL, the compiler substitutes it with zeroes. The following copiletime message is given: MSGID: LBL0481 SEVERITY: 20 SEQNBR: 006200 Message . . . . : 'SPACE' should not be moved to a numeric or numeric edited field. Zero substituted. If you move space to a group item, any numeric field inside will be unnumeric and will fail in moves/computes. Regards Geir -----Original Message----- From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx]On Behalf Of Roman Miklos Sent: Monday, October 16, 2006 1:00 PM To: COBOL Programming on the iSeries/AS400 Subject: [COBOL400-L] Moving SPACES in numerical fields Hallo, I have a little question about moving SPACES in numerical fields, maybe for beginners, but I nowhere found a clear answer :-) To ilustrate it first here is a little sample: IDENTIFICATION DIVISION. PROGRAM-ID. RECURTEST. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-AS400. OBJECT-COMPUTER. IBM-AS400. SPECIAL-NAMES. DATA DIVISION. WORKING-STORAGE SECTION. 01 PSSDPO-RECORD. 05 PSSDPO-KONTROLOR-GRP. 10 PSSDPO-KONTROLOR-INPT. 15 PSSDPO-KONTROLOR PIC 9(10). 10 PSSDPO-KONTROLOR-OUTP REDEFINES PSSDPO-KONTROLOR-INPT. 15 PSSDPO-KONTROLOR-EDIT PIC 9999999999. LINKAGE SECTION. PROCEDURE DIVISION. * Initialize Group-Items INITIALIZE PSSDPO-KONTROLOR-GRP. * Move SPACE into numeric field MOVE SPACE TO PSSDPO-KONTROLOR. MOVE SPACE TO PSSDPO-KONTROLOR-EDIT. * Move SPACE do Group-Item MOVE SPACE TO PSSDPO-KONTROLOR-INPT. MOVE SPACE TO PSSDPO-KONTROLOR-OUTP. GOBACK. 1) After the move in a numerical item e.g.: MOVE SPACE TO PSSDPO-KONTROLOR. The SPACE is treated such as the ZERO, i.e. PSSDPO-KONTROLOR has a value PSSDPO-KONTROLOR = 0000000000 2) After the move in the group item MOVE SPACE TO PSSDPO-KONTROLOR-INPT. Thu numerical field is filled with blanks i.e. PSSDPO-KONTROLOR = . a) Why didn't I get in case of 1) an error (e.g. 'Decimal data error') and why is SPACE treated as ZERO? b) Is the numerical field in case of 2) treated as character field because it's part of a group item? Regards Roman Mgr. Ing. Roman MIKLÓŠ Prvá stavebná sporiteľňa a.s. Bajkalská 30, P. O. Box 48 829 48 Bratislava 25 Tel.: +421/ 2 / 582 31 174 Fax: +421/ 2 / 582 31 109
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.