Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Receive the position of the cursor using AS400 COBOL

Status
Not open for further replies.

michtenn

Programmer
Aug 11, 2003
2
US
I am working on coverting programs from a S/36 (CBL36) mode to a AS400 (CBL) mode. I've run into 2 things that I have not been able to figure out. Hopefully someone can help me.

1) How do you get the position the cursor is at when the enter or a function key is pressed. This is how I have it set up on the S/36.


SELECT SCREEN-FILE ASSIGN TO WORKSTATION-OR001FM
ORGANIZATION TRANSACTION
CONTROL-AREA IS SCREEN-CONTROL-AREA.

01 SCREEN-CONTROL-AREA.
05 KEY-FUNCTION PIC 99.
88 ENTER-KEY VALUE 0.
88 CMD-KEY1 VALUE 1.
88 CMD-KEY2 VALUE 2.
88 CMD-KEY3 VALUE 3.
88 CMD-KEY4 VALUE 4.
88 CMD-KEY5 VALUE 5.
88 CMD-KEY6 VALUE 6.
88 CMD-KEY7 VALUE 7.
88 CMD-KEY8 VALUE 8.
88 CMD-KEY9 VALUE 9.
88 CMD-KEY10 VALUE 10.
88 CMD-KEY11 VALUE 11.
88 CMD-KEY12 VALUE 12.
88 CMD-KEY13 VALUE 13.
88 CMD-KEY14 VALUE 14.
88 CMD-KEY15 VALUE 15.
88 CMD-KEY16 VALUE 16.
88 CMD-KEY17 VALUE 17.
88 CMD-KEY18 VALUE 18.
88 CMD-KEY19 VALUE 19.
88 CMD-KEY20 VALUE 20.
88 CMD-KEY21 VALUE 21.
88 CMD-KEY22 VALUE 22.
88 CMD-KEY23 VALUE 23.
88 CMD-KEY24 VALUE 24.
88 CMD-PGDN VALUE 90.
88 CMD-PGUP VALUE 91.
05 TERMINAL-ID PIC X(2).
05 RESERVED PIC X(8).
05 CURSOR-ROW PIC 999.
05 CURSOR-COL PIC 999.

2) On the S/36 I have got logical files but off the physical file with multiple keys. I cannot compile these on the AS400. I am REALLY stumped on this one. What do you do to convert logical files (COBOL wise) from the system/36 to the AS400.

Thanks so very much. Please send any responses to pcampbell@wiscoenv.com

Phil Campbell :)
 
Answers only on the Forum

Can't check 1 now.

As for 2, can you please be more specific on your error?

In current AS400 you can have Phisical files and Logical files, and each one of then is created using a different command.
A logical file can be attached to more than one phisical file, although this is not normally used in COBOL
 
Start Length
CUST-NUMBER 1 6 Key to Physical file
CUST-TYPE 7 1
CUST-NAME 8 30

On the 36, in my logical view file definition SELECT statement I've got RECORD KEY IS CUST-NAME CUST-TYPE
CUST-NUMBER. This will not compile cleanly on the AS400 saying that I have too many keys defined.
 
Ah!.

Your problem is not with the Logical File, but with the COBOL program.

AS400/COBOL has a extension that allows the keys to be "externally-described key".

This works like this.
---
select filex assign to database-logicalfilename
record key is externally-described key
...

On the start you say
start filex key is < externally-described key.

By doing it this way the key description is taken from the logical file.

The only thing that is required is that the Logical file is pointing to the correct phisical(s).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top