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 to remove 2 duplicate records and copy only one using job control language?

1169


Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.

5670


In which area will you utilize 88 level items in cobol?

1098


What are the different open modes available in cobol?

1143


What is amode(31)

1109


What are the different data types in cobol?

1329


which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad

1451


What is a SSRANGE and NOSSRANGE?

1415


) How do u handle errors in BMS macro?

1908


Explain what you understand by passing by value.

1099


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

2324


How to use the same COBOL program in Batch and CICS on lines? explain with an example

2327


What is the problem of ordered sequential files access?

1109


Differentiate between structured cobol programming and object-oriented cobol programming.

1075


How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

3206