#1  
Old 11-30-2005, 08:40 PM
stefshuuj stefshuuj is offline
Member
 
Join Date: Sep 2005
Posts: 10
Idea Jounal Program - Loop Error

Hello again,

Slowely my CL skills are increasing, but unfortunately
again I am slightly stumped.

The program is designed to:
1. Display all objects within a library to an outfile.
2. Read the outfile
3. End Journalling on all PF
4. Loop till all PF have ended journalling
5. Delete Journal in library
6. Delete Journal Receiver in library
7. Create Journal Receiver in library
8. Create Journal in library
9. Display all objects to an outfile
10. Receive the outfile.
11. Start Journalling on all PF
12. Loop till all PF have been journalled.
13. End Program

Problem is that step 4. Loop and end journalling on all PF, once
this reached EOF, the program just ends.

How do I get this to simply just move to the next step?

Thanks in advance. You guys have helped me through many obstacles.

Regards
Stephen
Attached Files
File Type: txt JRNPRDLIB435378.txt (3.7 KB, 141 views)
Reply With Quote
  #2  
Old 11-30-2005, 09:47 PM
vjg's Avatar
vjg vjg is offline
System iNetwork Forum Pro
 
Join Date: Jul 2005
Location: St. Louis, MO, USA
Posts: 416
The code in red below is causing you to move directly to the end of your program immediately when you hit EOF on the first loop. That explains why you don't get past step 4.

Your other problem is that your second loop won't do anything because you can't restart reading the outfile again. If you are at V5R3, you can define two different outfiles and use one in each step.
Code:
          PGM        PARM(&LIB)

          DCL        VAR(&LIB) TYPE(*CHAR) LEN(10)
          DCLF       FILE(QADSPOBJ)
          OVRDBF     FILE(QADSPOBJ) TOFILE(QTEMP/JRNPRDLIB)

          DSPOBJD    OBJ(&LIB/*ALL) OBJTYPE(*FILE) +      
             OUTPUT(*OUTFILE) OUTFILE(QTEMP/JRNPRDLIB)
          MONMSG     MSGID(CPF2110) EXEC(SNDPGMMSG MSG('Library +
             Not Found'))
          MONMSG     MSGID(CPF2123) EXEC(SNDPGMMSG MSG('Object +
             Type Not Found'))
            
LOOP:     RCVF  
          MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))             
          IF         COND(&ODOBAT = PF) THEN(DO)
          ENDJRNPF   FILE(&LIB/&ODOBNM)
          MONMSG     MSGID(CPF0000)
          GOTO       CMDLBL(LOOP)
          ENDDO
             
      	  DLTJRN     JRN(&LIB/QSQJRN)
      	  
      	  DLTJRNRCV  JRNRCV(&LIB/QSQJRN*)
      	  
      	  CRTJRNRCV  JRNRCV(&LIB/QSQJRN0001) THRESHOLD(1000000)
      	  
      	  CRTJRN     JRN(&LIB/QSQJRN) JRNRCV(&LIB/QSQJRN0001) RCVSIZOPT(*MAXOPT2)
      	  
      	  DSPOBJD    OBJ(&LIB/*ALL) OBJTYPE(*FILE) +
             OUTPUT(*OUTFILE) OUTFILE(QTEMP/JRNPRDLIB)
          MONMSG     MSGID(CPF2110) EXEC(SNDPGMMSG MSG('Library +  
             Not Found')) 
          MONMSG     MSGID(CPF2123) EXEC(SNDPGMMSG MSG('Object +  
             Type Not Found'))
	  
LOOP1:    RCVF
          MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))
   
          IF         COND(&ODOBAT = PF) THEN(DO)  
          STRJRNPF   FILE(&LIB/&ODOBNM) JRN(&LIB/QSQJRN)                              
          MONMSG     MSGID(CPF0000)                                         
          GOTO       CMDLBL(LOOP1)                                         
          ENDDO   
          GOTO       CMDLBL(LOOP1)                                       
   
          RETURN
END:      ENDPGM
__________________
Virgil Green
Reply With Quote
  #3  
Old 12-05-2005, 04:18 AM
Ajay Ajay is offline
Member
 
Join Date: Nov 2005
Location: Pune
Posts: 30
Smile Use two CL program

Dear Stephen,

The RCVF command is used twice.... This is resulting in the loop going to the command label END.

As you are aware we can declare only one PF in a CL program, i would suggest that you can tackle the situation by using two CL programs and reading the file in the second CL program so that it is read from the beginning.

Regards
Ajay
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 07:29 AM.