From: Chris Ringer To: All
I'm on a S/36, but I'm trying to learn all I can about the AS/400. I'm hearing things about QTEMP. I believe that this is a temporary library. Is it a temporary library by user ID, workstation ID, or job? If I am running in the S/36E and one user runs a bunch of report programs that require a sort beforehand, the same file name will be used in all the jobs running.
I normally use ?WS??TIME? for the filename here on my S/36 and externally describe the file using ASNA's 400/RPG. I understand that this will cause problems on the AS/400 because the output of a sort will be a temporary file with a random name.
You can't use DDS in the case on the AS/400. I think I'll have to assign a known file name as the output of my S/36 sorts, externally describe it with ASNA and then plan on doing a clear file when moving to the AS/400. But if the file name I put in QTEMP is not by job, clear file may screw up some of the other reports simultaneously being generated by multiple copies of program X running at the same time.
From: Richard Shaler To: Chris Ringer
QTEMP is a temporary library that's unique for a job. When you sign-on, a QTEMP library is created and remains as a library that only your interactive job can use. If you submit a job to batch, a new job is started along with an associated QTEMP library. When the batch job ends, the QTEMP library goes away. With an interactive job, QTEMP does not go away until you sign off. So, if you create a file in an interactive job, that file will remain on the system unless you sign off or you explicitly get rid of it.
#GSORT on the AS/400 (native mode) is executed via the FMTDTA command. The output file must already exist but does not have to be defined with DDS. All files on the AS/400 have associated file definitions even though they may not have an associated DDS source member. For example, if you migrate a file from the S/36, you can run the display file field description (DSPFFD) command against it and find one field defined that is the length of the record. If the file has a key, a key field will also be defined.
Getting back to the sort. The #GSORT equivalent FMTDTA command requires your sort specifications to be contained in a separate source member. Before you execute the command, you could create the output file with the CRTPF command with a record length appropriate for you sort specifications. You could place this file in QTEMP. If the job is interactive you would either need to create a unique name for the file, or delete it or clear it, depending on whether the same file was going to be used in the same interactive job.
From: Pete Hall To: Chris Ringer
You can create a file with a variable name with DDS. You simply specify a source member name in the CRTPF command. As Richard noted, everything in QTEMP will go away when the job ends. It is important to note, however, that the definition of a "JOB" is slightly different on the AS/400 than it is on the S/36.
On the AS/400, for an interactive job, a "JOB" is everything that happens between sign-on and sign-off. On the S/36, job files go away when the first level procedure (?PROC?) ends. If you create work files in QTEMP, they might already exist when you execute an interactive menu option. Your OCL sorts will execute without modification in the S/36E. If you plan to convert them to FMTDTA however, you lose the ability to evaluate run-time substitutions and conditional branching.
FMTDTA is pretty much identical to the S/36 SORT procedure in this respect. It is fairly easy to convert OCL sorts with run-time substitution to OPNQRYF, and those without will generally be better off as logical views. In regard to porting your ASNA record definitions, you should be aware that although ASNA allows you to redefine fields within a record, DDS does not. Files which contain more than one record format (header and detail records, for instance) must be translated into several physical files, one for each record format, linked by a logical file in order to use field level DDS.
LATEST COMMENTS
MC Press Online