Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how to display date in reverse order if the pic clause of
the is numeric
suppose date is 09032010 ==> need to print in 20100309
(pic clause is numeric)

Answers were Sorted based on User's Feedback



how to display date in reverse order if the pic clause of the is numeric suppose date is 0903201..

Answer / reshma j.

INPUT-DATE has value of 09032010.

In working storage:
01 INPUT-DATE.
03 MM1 PIC 9(2).
03 DD1 PIC 9(2).
03 CCYY1 PIC 9(4).

01 PRINT-DATE.
03 CCYY2 PIC 9(4).
03 DD2 PIC 9(2).
03 MM2 PIC 9(2).

In Procedure Division:

MOVE MM1 TO MM2.
MOVE DD1 TO DD2.
MOVE CCYY1 TO CCYY2.

After Moving values,PRINT-DATE value will be 20100309.
In this cond,Its totally depend on how we declare format in
working storage section.

plz let me know,if i m wrong.

Is This Answer Correct ?    14 Yes 1 No

how to display date in reverse order if the pic clause of the is numeric suppose date is 0903201..

Answer / tata

id division.
program-id. exe.
data division.
working-storage section.
01 idate pic 9(8) value 10032010.
01 rdate pic 9(8).
procedure division.
move idate (1:2) to rdate (7:2).
move idate (3:2) to rdate(5:2).
move idate (5:4) to rdate(1:4).
display rdate.
stop run.

Is This Answer Correct ?    10 Yes 0 No

how to display date in reverse order if the pic clause of the is numeric suppose date is 0903201..

Answer / mf123

Thanks Reshma, ur absolutely correct,

Is This Answer Correct ?    6 Yes 1 No

how to display date in reverse order if the pic clause of the is numeric suppose date is 0903201..

Answer / rajesh

Both the answers are correct. But if we want to use the date
or month or year value alone in somewhere in our program
then we can go with Reshma's explanation.

Is This Answer Correct ?    3 Yes 1 No

how to display date in reverse order if the pic clause of the is numeric suppose date is 0903201..

Answer / nanda

*********************** Top of Data ****
ID DIVISION.
PROGRAM-ID. ALLINONE.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-DATE1.
05 DD PIC 9(2).
05 MM PIC 9(2).
05 YY PIC 9(4).
01 WS-DATE2.
05 YY PIC 9(4).
05 MM PIC 9(2).
05 DD PIC 9(2).
PROCEDURE DIVISION.
ACCEPT WS-DATE1.
MOVE CORR WS-DATE1 TO WS-DATE2.
DISPLAY WS-DATE1.
DISPLAY WS-DATE2.

STOP RUN.

Is This Answer Correct ?    1 Yes 0 No

how to display date in reverse order if the pic clause of the is numeric suppose date is 0903201..

Answer / aruna

both the ans are coreect.in reshma's ans directly we can
write corr mve statement behalf of those 3move
statements.simply we can write move corr input-date to
output-date.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More COBOL Interview Questions

Why we should use cursor ?

3 Answers  


What kind of error is trapped by on size error option?

0 Answers  


what is ASRA, AEY9?

2 Answers   IBM,


given the following piece of code: CALL SUB-PGM USING A, B, C. CALL SUB-PGM USING A, C, C. (a) Both CALL statements will always produce same result. (d) Both CALL statements may produce different result. (c) Compile-time error because SUB-PGM is a dataname. (d) Compile-time error because A, B, C are used twice.

2 Answers   TCS,


Will the variable POS in the following code have a value of 2 or not? 01 POS PIC S9(4) COMP VALUE 2. 01 FIRST-NAME PIC X(10) VALUE 'ABC'. 01 LAST-NAME PIC X(10) VALUE 'XYZ'. 01 NAME PIC X(20) VALUE SPACES. STRING FIRST-NAME DELIMITED BY SPACES ' ' DELIMITED BY SIZE LAST-NAME DELIMITED BY SPACES INTO NAME WITH POINTER POS

2 Answers  


u have passed sme charecters thru parm parameter in jcl. how do u code in cobol to recieve the values u gave in parm ?

2 Answers   IBM,


can u plz expain me how to declare dynamic array? what is the meaning of depending on clause in dynamic array?

3 Answers   IBM, Satyam,


Write a cobol program making use of the redefine clause.

0 Answers  


How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?

0 Answers   HeadStrong,


what will happen if i give program name and member name as different? program runs successful or w'll abend?

5 Answers   CTS,


How do you define a variable of COMP-1? COMP-2?

3 Answers  


ID DIVISION. PROGRAM-ID. PLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 VAR1 PIC 9(2). 01 VAR2 PIC X(2). PROCEDURE DIVISION. ACCEPT VAR2. MOVE VAR2 TO VAR1. STOP RUN. if i give 'PI' in var2 then what will b output of progr. any abend?????

6 Answers   TCS,


Categories