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 string in the reverse order using occurs
clause?

Answer Posted / nk

01 MY-STRING PIC X(9) VALUE 'ABCDEFGHI'.
01 FILLER REDEFINES MY-STRING.
05 CHAR OCCURS 9 TIMES. (could use INDEXED BY here)
01 OUT-STRING PIC X(9).
01 IDX-IN PIC 9.
01 IDX-OUT PIC 9.
MOVE 9 TO IDX-IN.
PERFORM MOVE-A-CHAR (could also do an inline PERFORM)
VARYING IDX-OUT FROM 1 BY 1
UNTIL IDX-OUT > 9.
MOVE-A-CHAR.
MOVE CHAR(IDX-IN) TO OUT-STRING(IDX-OUT).
SUBTRACT 1 FROM IDX-IN.
MOVE-A-CHAR-EXIT.
EXIT.

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How you can read the file from bottom?

1135


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

1219


) How do u handle errors in BMS macro

2014


How many bytes S(8) comp field occupy and its maximum value?

2129


I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue

2521


how do you reference the fixed unblock file formats from cobol programs

1213


How to know whether the module is dynamical or statistical?

1124


What are the different rules for performing sort operation?

1204


explain sorting techniques in cobol program?

1181


Which division and paragraphs are mandatory for a COBOL program?

1254


System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..

2055


What are the cobol coding sheets?

1246


How do you get the data to code the BMS macro?

1955


Explain how you can characterize tables in cobol?

1047


What are 77 levels used for?

1096