1. Need help useing SEU editor for COBOL on the AS400.
2. Have managed to make a source code file in a library, but dont have a
book on the editor yet for COBOL. Are there instructions online?
3. How do I compile the COBOL Source Code to object code(Menu/command)?
4. How does the JCL work to run the program(Know a little on Syst 36).
5. How do you change the object properties on a library? And why cant people
make or create files in the library?
6. How do you write the access statement for accessing a file using dynamic
access and a keyfield? We want to enter the acct# and access only the
records that match and end the file when 9999 is reached.
If you know of any easy to understand (simple simon) instructions on the net
for beginning AS400 programmers, that would be helpful.
All manuals are also on the net, at http://as400bks.rochester.ibm.com/
Charles Hammond wrote:
> Setting up new AS400 for our Advanced Programming Class. We have user
> profiles and PGMR, but are having problems with writing and accessing source
> code.
>
> 1. Need help useing SEU editor for COBOL on the AS400.
STRSEU & press F4.
For help, press the HELP key (or F1) - it's all there.
If you want SEU to check syntax while editing, make sure your sourcemember is of
type CBL (for "old" Cobol compiler) or CBLLE (for "new" ILE-Cobol compiler). You
can enable/disable syntaxchecking in SEU with F13 ... some option there.
> 2. Have managed to make a source code file in a library, but dont have a
> book on the editor yet for COBOL.
SEU is not language dependant.
> Are there instructions online?
See above.
> 3. How do I compile the COBOL Source Code to object code(Menu/command)?
CRTCBLPGM + F4 for "old" (aka OPM) Cobol (sourcetype CBL)or CRTBNDCBL + F4 for
"new" (aka ILE) Cobol (sourcetype CBLLE)
If you use PDM (well, you are, because SEU is part of it), you may also enter
"14" next to your sourcemember and press F4 - this will prompt you the
apropriate command.
> 4. How does the JCL work to run the program(Know a little on Syst 36).
It's called CL (Command language) on the AS400. You can put all commands the
AS400 has into CL-programs + compile with CRTCLPGM (or option 14 in PDM).
Simplest form would be to enter "CALL mypgm" in a command line, or use option 16
in PDM (with your program object, not the source).
> 5. How do you change the object properties on a library? And why cant people
> make or create files in the library?
What did you do, and what error did you get? Maybe not auhorised to library
(then see EDTOBJAUT command) ?
> 6. How do you write the access statement for accessing a file using dynamic
> access and a keyfield? We want to enter the acct# and access only the
> records that match and end the file when 9999 is reached.
I understood YOU want to teach Cobol, huh?(see Cobol reference)
> If you know of any easy to understand (simple simon) instructions on the net
> for beginning AS400 programmers, that would be helpful.
Sorry to say, but you definitely need some classes yourself ...
Good Luck, Martin
>1. Need help useing SEU editor for COBOL on the AS400.
You first need to create source files. I would recommend one per
student. The command is CRTSRCPF FILE(library/file).
There are several ways to start SEU on the AS/400. You could issue the
command STRPDM and then select Work With Members. You can also issue
the command WRKMBRPDM or STRSEU. In any case, you will be asked for
the source file and library. You should give this to your students
ahead of time.
When the students create a member (it is a command key off the
display) they should use member type CBL or CBLLE (ILE/COBOL). This
will force the editior to use the COBOL format line and editior.
>
>2. Have managed to make a source code file in a library, but dont have a
>book on the editor yet for COBOL. Are there instructions online?
If you have a new system, you should also have gotten a CD with the
IBM Softcopy Library on it. Follow the instructions to load the IBM
Library reader program on a PC. The Cobol Reference Manual and COBOL
Programmer Guide are in the Programming Languages and Tools bookshelf.
The SEU manual is in the same bookshelf.
>
>3. How do I compile the COBOL Source Code to object code(Menu/command)?
Unless you are writing COBOL modules (object code) you should create
program objects directly. To do this, exit the source code with F3 -
Exit, answer Y to update the source. If you are using PDM then type 14
next to the source member on the option line and away you go. Before
doing this make sure that the options (F18) on the member list is set
to Compile in Batch = Y, otherwise your students will be doing on-line
compiles. This is generally not a good thing.
>
>4. How does the JCL work to run the program(Know a little on Syst 36).
To run the program you use CL (control language) programs or command.
JCL is mainframe Job Control Language.
Assuming you don't need any file overrides or special instruction
(most students don't) the CL command typed on the command line is:
CALL program - for an interactive run
SBMJOB CMD(CALL program) - for a batch run - there are other optional
parameters such as job name you may want to consider using.
That's it.
The CL source for a batch run is:
PGM
SBMJOB CMD(CALL PGM(cobol program))
ENDPGM
Compile this object (the CL source and CL program will need a
different name from the COBOL program.
Then on a command line type CALL clprogram - and away you go.
>
>5. How do you change the object properties on a library?
It depends on the object properites you want to change. Some are
changed with WRKOBJPDM library - hit enter. Option 2 gives you the
abiliity to change certain objects. My system is not up right now, so
I cannot tell you if you can change security from this screen. If you
cannot, then issue EDTOBJAUT library/object objecttype and press
enter. This will let you change security on that object.
>And why cant people make or create files in the library?
It is a security issue. Giving the exact message id and message would
help in diagnosing the problem. Also see the answer immediately above
and the answer to question 1.
>
>6. How do you write the access statement for accessing a file using dynamic
>access and a keyfield? We want to enter the acct# and access only the
>records that match and end the file when 9999 is reached.
First, using 9999 to detect end-of-file is an obsolete coding
practice. The COBOL READ statement has the ability to detect end of
file and that is what you should be teaching your students to use
(IMHO). Also you should teach your student to use the END-statement
construct (see sample code) rather than just end statements with a '.'
(IMHO)
In this discussion I am assuming that you are using
externally-descibed files and either the physical file is keyed or you
are using a logical file with the correct key. In the examples UPPER
CASE WORDS are COBOL reserved words, some are optional. Lower case
words are your program variables. This is sample code, I have not
tested the code, but it should get you going.
You will need an ENVIRONMENT DIVISION
INPUT-OUTPU-SECTION
FILE CONTROL paragraph.
You will need a Format 2 - Indexed File entry. The 'key' phrases are
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
RECORD KEY IS EXTERNALLY-DESCRIBED-KEY
WITH DUPLICATE (use if present)
ASSIGN TO DATABASE- filename
You will need an Data Division FILE SECTION entry for the file.
FD FILE- filename
LABEL RECORDS ARE STANDARD.
01 your-internal-name.
COPY DDS-ALL-FORMATS OF file-library.
In the DATA DIVISION WORKING-STORAGE SECTION.
01 END-OF-FILE-FLAG USAGE IS BOOLEAN.
88 END-OF-FILE VALUE B"1".
88 NOT-END-OF-FILE VALUE B"0".
PROCEDURE DIVISION.
OPEN INPUT file-name-1.
MOVE FALSE TO END-OF-FILE-FLAG.
COMPUTE externally-described-key = student-input
student-input has to be described in working storeage or the
file section.
START file-name KEY IS EQUAL TO EXTERNALLY-DESCRIBED-KEY
INVALID KEY imperative-statement-1
If the key is invalid it was not found - so execute a
subroutine to handle and do not read file.
END-START.
PERFROM READ-FILE THRU READ-FILE-EXIT
UNTIL END-OF-FILE
WITH TEST BEFORE
END-PERFORM.
CLOSE file-name-1.
STOP RUN.
READ-FILE.
READ file-name NEXT RECORD
INTO identifier-1
FORMATIS literal-1
AT END MOVE TRUE TO END-OF-FILE-FLAG
NOT AT END MOVE FALSE TO END-OF-FILE-FLAG
END-READ.
IF student-input IS NOT EQUAL TO externally-described-key
THEN
MOVE TRUE TO END-OF-FILE-FLAG
END-IF.
IF NOT-END-OF-FILE (this is your logical condition)
THEN
do your processing - best in another subroutine
END-IF.
READ-FILE-EXIT.
EXIT.