I encountered an error when I move spaces to a numeric
field?What should I do to move spaces on that field?help
please.
Answers were Sorted based on User's Feedback
Answer / ramesh
first numeric field rediffens alpha numeric field
then you check numeric and move spaces to redifened name
ex:
01 num pic 9(09).
01 num1 rediffens num.
02 num2 pic x(09).
if num is numeric
move spaces to num2
end-if.
| Is This Answer Correct ? | 20 Yes | 0 No |
Answer / mahesh
Thing is that spaces can't be moved to numeric fields,
u can move only zeros and other numeric values to numeric
fields, spaces can be moved to alphanumeric and alphabetic
fields only.
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / nitesh sethi
Use option BLANK WHEN ZERO for that field and initialize
that field.
Initalize will move zeroes to that field and declarion of
that field with BLANK WHEN ZERO will not have zeroes in
that field.
Directly moving spaces to a numeric field is not possible
as it will result in SOC7 Abend
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sundar
Directly move space to numeric fields encount severe error.
But if you move space to another alphanumeric field and
then move to numeric field then this will not get any error.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / arpan
We need to use Initialize for Numeric and SPACES for Alpha
numeric fields.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / sundar
Move space to the numeric field not getting any error.
However if that numeric field involves any arithmatic
operation than it will get abend.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / guest
IF I-field-name IS NUMERIC
MOVE SPACES TO I-field-name
END-IF
| Is This Answer Correct ? | 2 Yes | 4 No |
Answer / guest
IF I-field-name EQUAL ZEROES
MOVE SPACES TO O-field-name
END-IF
| Is This Answer Correct ? | 1 Yes | 5 No |
i have the following varibles in the working storage 05 ws-A PIC X(30) VALUE 'ABCDEFGHIJKLMNOPQRESTUVWXYZ ' 05 WS-B REDEFINES WS-A 10 WS-B1 PIC X(10). 10 WS-B2 PIC 9(10). 10 WS-B3 PIC X(10). If I Display B1, B2 and B3 respectively, what is the value displayed in B2
How can I tell if a module is being called DYNAMICALLY or STATICALLY?
What will happen if you code GO BACK instead of STOP RUN in a stand-alone COBOL program i.e. a program which is not calling any other program ?
I need to compare two VSAM files, both having 'number' as key. If there is a matching record, write the data into another VSAM file. How will it be possible.
01 a pic x(6) value is abcdef 01 b pic x(3) move a to b wht will be the value in b ?
01 A pic 9(100) find record length of it
How to read a 100 record from a file through cobol?
Using string statement.Is coding three destination string from one source string possible in one code?or three codes for every destination string of one source string.?thank you
I have the file which is having the extension no as records. sample file will look like below. 2310 3410 3256 4350 3781 5408 I need to replace the record which is starting with 3 to 5 (i.e) 3410 to 5410. How can we do it through cobol and cobol-db2 program? I need the possible logic?
I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.
How do you reference the following file formats from cobol programs?
File status must be checked both while opening and reading the file or only while reading the file?