01 a pic s9(5) value -12345,
if we disply a , the sign will overpunched with last digit
but i need to get the miuns sign in the result?

Answers were Sorted based on User's Feedback



01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i ..

Answer / david

you will need two variables. Variable A where you put your
computation and variable B which will be displayed:

01 a pic s9(5) value -12345.
01 b pic -9(5).
or 01 b pic -zzzz9.
or 01 b pic 99999-.
or 01 b pic z(5)-.
or 01 b pic ----9.

MOVE A TO B.
DISPLAY B.

Is This Answer Correct ?    7 Yes 0 No

01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i ..

Answer / satish

01 a pic -9(5) value -12345

Answer : either of the below :

01 a pic -9(5) value -12345 will working without any
changes or
01 a pic 9(5) value -12345 leading seperate

Is This Answer Correct ?    2 Yes 0 No

01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i ..

Answer / saravana

01 A pic s9(5) value -12345
01 B pic -9(5)
PROCEDURE DIVISION
MOVE A TO B
DISPLAY B
STOP RUN

o/P:
-12345

Is This Answer Correct ?    2 Yes 0 No

01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i ..

Answer / sowjanya

give like below.

DISPLAY A SIGN LEADING SEPARATE.

Is This Answer Correct ?    1 Yes 0 No

01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i ..

Answer / mr.perfect

01 A pic s9(5) value -12345
01 B pic +9(5)
PROCEDURE DIVISION
MOVE A TO B
DISPLAY B
STOP RUN

o/P:
-12345

Will this work?

Is This Answer Correct ?    1 Yes 0 No

01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i ..

Answer / anil prajapati

For displaying sign in the result we have to declare a
variable with negative sign symbol
e.g. 01 b pic -9(5).

in this variable we will this value

Is This Answer Correct ?    0 Yes 0 No

01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i ..

Answer / sreejith

01 a pic -9(5) value -12345
or
01 a pic x(6) value '-12345'

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More COBOL Interview Questions

What should be the sorting order for SEARCH ALL?

5 Answers  


How can you add a particular field/coloumn in copybook?

3 Answers   ADP, DELL, L&T,


I want ALL ERROR codes in VSAM

3 Answers   American Express, TCS,


hie everyone.i just completed my b.tech in electronics and joined mainframes course.am i doing right course for my better future?please help me with your suggestions.ill be very thankful to you guys.

2 Answers  


If there are two copybooks which have same variables and we are using both the copybooks in our program. will there be an error and if i move values to the variable which copybook varibales gets the values i move in.

3 Answers   CTS,






A paragraph PARA-X is to be executed when none of the data names A, B and C have value of 1. Which of the following will achieve this ? (a) IF A NOT = 1 OR B NOT = 1 OR C NOT = 1 PERFORM PARA-X (B) IF NOT A= 1 AND B= 1 AND C = 1 PERFORM PARA-X (C) IF A NOT =1 IF NOT B = 1 OR C= 1 PERFORM PARA-X (C) IF A NOT = 1 AND B NOT = 1 AND C NOT = 1 PERFORM PARA-X

3 Answers   TCS,


What is the utilization of copybook in cobol?

0 Answers  


How to resolve the soc4 and soc7 errors?

5 Answers   IBM, RBS,


Read filea And file b write the same records in both files? Records in a but not in b record in b but not in a

3 Answers   TCS,


What is the difference between external and global variables in COBOL?

0 Answers   Winsol Solutions,


a. Can the OPTIONAL clause in COBOL only be coded for input files? b. If it is coded for files opened in OUTPUT, I-O or EXTEND mode, will it give a compilation error? c. If there are no compilation errors and if such files are not coded in the JCL, will the OPEN statement run fine when these files are opened? d. How will a WRITE statement work for the above files?

2 Answers  


How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning.

7 Answers   CGI, TCS,


Categories