There are many ways to manipulate nonnumeric data in a COBOL program. For example, you can:
Moving Data Items (MOVE Statement)
You can move data around with the MOVE statement. When you move a group item to another group item, be sure that the subordinate data descriptions are compatible. If you specify a MOVE statement for file items or Working-Storage items that overlap, you will get a warning message at compile time. However, the move will take place with destructive overlap if you choose to ignore the warning
Counting and Replacing Data Items (INSPECT Statement)
The INSPECT statement is useful for filling selective portions of a data item with a value, or for replacing portions with a corresponding portion of another data item. You can also use it for counting the number of times a specific character (zero, space, asterisk, for example) occurs in a data item.
Joining Data Items (STRING Statement)
You can use the STRING statement to join all or parts of several data items into one data item. One STRING statement can save you several MOVE statements. The STRING statement transfers data into the receiving item in the order you specify. You can specify:
Splitting Data Items (UNSTRING Statement)
You can use the UNSTRING statement to split one sending field into several receiving fields. One UNSTRING statement can save you several MOVE statements. As with the STRING statement, you can specify delimiters that, when encountered in the sending field, cause the current receiving field to be switched to the next one specified. You can get back the number of characters placed in each receiving field, and you can keep a count of the total number cjf characters transferred. If all the receiving fields are filled before the end of the sending item is reached, you can specify special actions for the program to take.
You can use a VALUE clause in the Data Division to initialize data items, or you can initialize them in the Procedure Division. Use the VALUE clause to set data items to the values you want them to have when the program is in its initial state. In the Procedure Division, you can use any of the following statements to initialize data items: INITIALIZE, INSPECT, MOVE, SET, etc. It is recommended that initialization in the Procedure Division be done in a separate paragraph at the beginning of the division. This paragraph can also contain OPEN statements for files used in the program.
Manipulating Addresses with Pointer Data Items
Pointer data items can contain virtual storage addresses. You define them explicitly with the USAGE IS POINTER clause in the Data Division or implicitly as ADDRESS OF special registers. Pointer data items can be:
You can use pointer data items when you want to accomplish limited base addressing, particularly when you want to pass and receive addresses of a variably located record area. You can also use pointers to handle a chained list.
IBM Mainframe Related Interview Questions
|IBM Lotus Notes Interview Questions||IBM-CICS Interview Questions|
|COBOL Interview Questions||Linux Interview Questions|
|IBM-JCL Interview Questions||IBM Mainframe Interview Questions|
|IBM AIX Interview Questions||IBM WAS Administration Interview Questions|
|IBM Lotus Domino Interview Questions||IBM Integration Bus Interview Questions|
|Mainframe DB2 Interview Questions||Unix Production Support Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.