|
> Fra: Rajan.Srinivasan@Allfun.com > Til: MIDRANGE-L@midrange.com > Emne: Retrive Object name in a CL > Dato: 9. april 1999 19:17 > > > I tired using DSPOBJD, and put all the object desc into a data File , > but that too did'nt help because I dont know how to read that in CL . > > > Is there any other way I can do?. > > Any help is greatly appreciated. > Hi Rajan That's simple. Here is a starters course: 1. CLPGM: DCLF FILE(QADSPOBJ) This declares the file to the program just like RPG's F-spec. The file must exist in libl. A good idea is to use the file name from QSYS. If you are handling output from DSPOBJD OUTPUT(*FILE) the help from DSPOBJD says : The database format (QLIDOBJD) of the output file is the same as that used in the IBM-supplied file database QADSPOBJ. It's quite OK to use the 'model file' in QSYS here - se below. 2. CLPGM: DSPOBJD xxxxx OUTPUT(*OUTFILE) OUTFILE(MYLIB/MYFILE) Here you create the file you want to read. The name and library of the file is totally different from declared file, so: 3. CLPGM: OVRDBF FILE(QADSPOBJ) TOFILE(MYLIB/MYFILE) It's OK to do the override now, because the file is not opened yet. This will be done first time you do the first RCVF-command: 4. CLPGM: RCVF DEV(*FILE) This command opens the file and gets the first record. All the fields are known it the program in &FIELD1, &FIELD2 etc. What will happend if there is no more records in the file? Yos the RCVF will get an exception that you must monitor for: 5. CLPGM: MONMSG MSGID(CPF0864) EXEC(GOTO EOF) /* End of file detected for file &1 in &2.*/ where label EOF: is probably near the end of program. If however no exception is recieved you do with the fields what you want and ends with an GOTO step 4. That's all there is to it. There are many restrictions to file handling in CLP's. You can only declare and recieve records from one file in a program, so if you need more you have to call a subprogram to do this. Good luck Regards Henrik Krebs ------------------------------------------------------------ Henrik Krebs IT Consultant (IBM AS/400) Phone +45 55 44 26 50 Mobile +45 40 88 83 23 Email: hkrebs@hkrebs.dk Web: http://www.hkrebs.dk/ Snailmail: Kokhaven 8, DK-4736 Karrebaeksminde ------------------------------------------------------------ +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.