Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Reading a record from a CL program

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading a record from a CL program

    You will need to DCLF and then RCVF. If you search this fora, you will find lots of info on this......I know because the first question I ever posted here dealt with this subject (almost 4 years ago)! HTH, Joe

  • #2
    Reading a record from a CL program

    Here is a little CL program: PGM DCLF FILE(MYLIB/OBJLIST) RE: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO EP) CHGOBJOWN OBJ(&ODLBNM/&ODOBNM) OBJTYPE(&ODOBTP) + NEWOWN(XXXX) /* Change it */ GOTO CMDLBL(RE) EP: ENDPGM

    Comment


    • #3
      Reading a record from a CL program

      Thanks , as soon as I saw your post I remembered. You were a great help!

      Comment


      • #4
        Reading a record from a CL program

        That was great , now can it perform the chgobjown based on a value in a field in the file? field1 = 'MYFILE' ? Also have you ever saved an SQL stmt to a source file? I have but then I'm stuck I don't know how to reuse all the statments.

        Comment


        • #5
          Reading a record from a CL program

          Hi, I'm glad this helped. If you want to use 'CHGOBJOWN', for first you must create this 'OBJECTS' file. My was created manually, not in this program using this command: DSPOBJD OBJ(*USRLIBL/*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE) OUTFILE(MYLIB/OBJLIST) In my program &ODLBNM and &ODOBNM fields are from this file. But you can create your own file, based on another CL command. It depends what is needed. A lot of CL commands create file. This is a very useful feature.

          Comment


          • #6
            Reading a record from a CL program

            Hi, I'm sorry that I wasn't very clear in my last email. I use Dspobjd to an *outfile all the time and it's VERY helpful when doing analysis on system objects etc. I was asking if you knew how to do a SELECTIVE action on an item based on a conditional value of a field in the file. I.E. change the Object owner of the object only if the object attribute field is EQ to 'X'. I'm not actually doing the CHGOBJOWN action. I would like to repetively run an SQL command based on the value of a field in another file but I'm having additional problems with that as my pre-compiler doesn't want to recognize my SQL commands.

            Comment


            • #7
              Reading a record from a CL program

              Long ago I wrote a CL program that read a record from a physical file, processed it using some cl commands and then the cl looped back to read the next record. I haven't been writing code for a while so I've forgotten the CL command that would do this. Does any one remember?

              Comment


              • #8
                Reading a record from a CL program

                It's very easy to do this (IF ....): PGM DCLF FILE(MIRALIB/OBJLIST) RE: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO EP) IF COND(&ODOBOW *EQ 'QSECOFR') THEN(DO) CHGOBJOWN OBJ(&ODLBNM/&ODOBNM) OBJTYPE(&ODOBTP) + NEWOWN(MIRA) ENDDO GOTO CMDLBL(RE) EP: ENDPGM Between DO & ENDDO you can execute another commands too.

                Comment

                Working...
                X