View previous topic :: View next topic |
Author |
Message |
vanight Beginner
Joined: 15 Jul 2003 Posts: 4 Topics: 3
|
Posted: Tue Jul 15, 2003 6:00 pm Post subject: Help with some COBOL/CICS self study questions - Please |
|
|
Hello. I am new to this forum and new to COBOL and CICS. I seem to learn best by finding the answer to a question and the reverse engineering how the answer was obtained. I would like some of you to take a shot at these questions with a quick explanation of your answer. I dont have much money and I am trying to find as much material for free online as I can. Also, is there a way to simulate the environment? Like CISCO has a router simulator. A list of commands with how they are used would be helpful if anyone knows of a good one............Vanight
Thanks for any help!! Here are the questions:
1. In CICS, ddname "File a" is pointing to VSAM.FILEA.CLUSTER. How would you change the ddname to point to VSAM.FILEB.CLUSTER?
2. The client asks for information in SSN-NO order. The VSAM file that will be used for input will not have duplicates and is laid out as follows:
EMPL-NO PIC X(10) PRIMARY KEY
SSN-NO PIC 9(9)
EMPL-NAME PIC X(25)
How would you accomplish this?
3. You have the same VSAM file as above. You want to retrieve the record just prior to the EMPL-NO of `2234444444' without reading the whole file. How do you do this? |
|
Back to top |
|
|
warp5 Intermediate
Joined: 02 Dec 2002 Posts: 429 Topics: 18 Location: Germany
|
Posted: Wed Jul 16, 2003 1:10 am Post subject: |
|
|
To question 1:
Temporarily with CEMT S FILE(FILEA) .....
Permanently with CEDA EXP GROUP(*) FILE(FILEA) |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Jul 16, 2003 8:47 am Post subject: |
|
|
vanight,
Welcome to mvsforums.you don't have to spend money for the manuals these days. All the IBM manuals are available online and are free. You can access them via main page of www.mvsforums.com
Since you are a application developer, I would recommend the following books
CICS Application Programming Guide
CICS Application Programming Reference
Now coming to your questions, the first question is already answered , so here are the answers for the rest of them.
Code: |
2. The client asks for information in SSN-NO order. The VSAM file that will be used for input will not have duplicates and is laid out as follows:
EMPL-NO PIC X(10) PRIMARY KEY
SSN-NO PIC 9(9)
EMPL-NAME PIC X(25)
|
How would you accomplish this?
Answer:
A.Define an Alternate Index on SSN-NO using the DEFINE ALTERNATEINDEX command.
B.Relate the alternate index to the base cluster (the data set to which the alternate index gives you access) by using the DEFINE PATH command.
C.Build the alternate index by using (typically) the BLDINDEX command. Identify the input file as the indexed data set (base cluster) and the output file as the alternate index or its path. This command BLDINDEX reads all the records in your VSAM indexed data set (or base cluster) and extracts the data needed to build the alternate index.
D.Assign the alternate path to the ddname and in the program read the file sequentially
Code: |
3. You have the same VSAM file as above. You want to retrieve the record just prior to the EMPL-NO of `2234444444' without reading the whole file. How do you do this?
|
Answer: You start a browse with the STARTBR command, identifying a particular record in the same way as for a direct read. However, the STARTBR command only identifies the starting position for the browse; it does not retrieve a record. Issue a STARTBR command with RIDFLD specifying the key of a record(in your case '2234444444').
Now issue READPREV to get the prior record to the given record.
Code: |
MOVE '2234444444' TO WS-EMP-NO
EXEC CICS STARTBR
DATASET(DDNAME)
RIDFLD(WS-EMP-NO)
EQUAL
RESP(CICS-RESP)
END-EXEC
EVALUATE CICS-RESP
WHEN +0
PERFORM 20000-READPREV-RECORD
PERFORM 30000-END-BROWSE
WHEN OTHER
MOVE CICS-RESP TO WS-ERROR-CODE
MOVE 'STARTBR ERR' TO WS-ERROR
END-EVALUATE
.
EXEC CICS
READPREV DATASET(DDNAME)
INTO (EMP-RECORD)
RIDFLD (WS-EMP-NO)
END-EXEC
.
30000- END-BROWSE.
EXEC CICS ENDBR
DATASET(DDNAME)
RESP(CICS-RESP)
END-EXEC
.
|
Hope this helps....
cheers
kolusu
Ps: Please do not post the same question in different forums. |
|
Back to top |
|
|
|
|