How to write a IDMS code to find whose employee last name is starting with J and first name starts with H.

Showing Answers 1 - 6 of 6 Answers

amuseham

  • Jan 29th, 2009
 

 01  WS-EMPLOYEE-NAME. 
       05  FIRST-INITIAL             PIC X.
       05  FILLER                        PIC X(29).    
......  
* WS-INITIAL-LETTER could be defined separately and set to 'J'
MOVE LOW-VALUES TO WS-EMPLOYEE-NAME.
MOVE WS-INITIAL-LETTER TO FIRST-INITIAL.
MOVE WS-EMPLOYEE-NAME TO EMPLOYEE-NAME.  
* This is randomly accessing EMPLOYEE-NAME based on a partial key / string indexed * search using a 'secondary' index which is system owned. IX-EMPLOYEE-NAME is the * system owned index in this example. 
OBTAIN EMPLOYEE-REC WITHIN IX-EMPLOYEE-NAME USING EMPLOYEE-NAME.  
........  
OBTAIN NEXT EMPLOYEE-REC WITHIN IX-EMPLOYEE-NAME.

*** The program must check for first letter in every record occurrence which it walks through that name still starts with 'J' and should exit loop / stop walking the set when when employee name does not start any longer with 'J'. 

  Was this answer useful?  Yes

anjibmk

  • Aug 4th, 2011
 

WORKING-STORAGE SECTION.

01 WS-REC-DATA.

10 VAL1 PIC X(..). 10 ... 10 ...

10 EMP-NAME PIC X(...).

15 EMP-FIRST-NAME PIC X(..).

15 EMP-LAST-NAME PIC X(..).

PROCEDURE DIVI.

SA. ** AFTER BIND,

READY SET FIRST-REC-YES TO TRUE.

OBTAIN FIRST TABLE-NAME WITHIN AREA-NAME

SET FIRST-REC-NO TO TRUE

MOVE IDMS-REC-DATA TO WS-REC-DATA.

IF EMP-LAST-NAME(1:1) = 'J'

DISPLAY EMP-NAME. SB.

OBTAIN NEXT TABLE-NAME WITHIN ARE-NAME ON DB-END-OF-SET

GO TO SZ.

MOVE IDMS-REC-DATA TO WS-REC-DATA.

IF EMP-LAST-NAME(1:1) = 'J' DISPLAY EMP-NAME.

GO TO SB.

SZ.

EXIT.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions