Submitted by Kim Egekjaer on Fri, 10/29/2010 - 00:00
Forums

There is from time to time a bit of surprise when users need to realize, that Auto Forms Control will execute ALL lines that fit the current spooled file (and that the spooled file attributes are only retrieved only once).

Lets Us consider a small change to the AFC detail lines shown above. We add a simple function: 6- Hold spooled file below:

0001    8     DEMO                                                         
              Call, program: RUNSFI library: APF3812 User profile AFCOPER  
0002    *     Handle reprint:                                              

0003    1     COPY                                                        
              Merge, Overlay: IF400DEMO Fileset: SAMPLE                   
0004    *     Handle first time print:            

0005    1     NO_COPY                                                        
              Merge, Overlay: IF400DEMO Fileset: SAMPLE                      
0006    8     NO_COPY                                                        
              Call, program: ARCHIVE library: MYLIB User profile AFCOPER  
0007    6                       
              Hold Spooled File

 

The last line is intended to hold the spooled file after printing and perhaps also archiving the spooled file. If you try this out you would possibly be surprised: This does NOT work... Why?

Well the spooled file is 'born' with the form type 'DEMO' and then the sequence line 1 is triggered. The will change the spooled file form type into either 'COPY' or 'NO_COPY' and will hold and release the spooled file to add a new entry in the data queue for this output queue, BUT AFC will go on with the original form type (DEMO) and check if there are any other sequence lines, that should be executed and there is: In line 7 the spooled file will be held. The changed form type will not be detected immediately as the spooled file attributes are only retrieved once.

With line 7 AFC is done with the first entry in the data queue and now it detects that the same spooled file as a second entry in the data queue, and InterForm400 starts to retrieve the new spooled file attributes. The new form type will be either COPY or NO_COPY, but unfortunately the status of the spooled file is now 'Held' as we held it above in line 7.

Now InterForm400 will refuse to work with the spooled file as it is held and instead issue this message in the joblog:

Additional Message Information                      

Message ID . . . . . . :   AFC5013       Severity . . . . . . . :   00      

Message type . . . . . :   Information                                      

Date sent  . . . . . . :   29/10/10      Time sent  . . . . . . :   11:46:51


Message . . . . :   Dataqueue entry received - Job 089031/KSE/QPADEV000B    

  Spoolfile name EDTPRT Number 2. The file has been changed to HOLD(*YES), so

  it is ignored.

 

If you try a setup like below in an older InterForm400 version you will even get an MSGW in AFC:

Update AFC-functions attached to output queues               AFC305D

Queue:   AFC_INPUT1     Library:   APF3812                                  

Seqnbr Funct   Form type  Save Jobname    Filename   Device file  Program   
 0001    7     DEMO                                                         
               Delete Spooled File                                          
 0002    5                                                                  
               Move spooled file, new outq: *DEFAULT

 

Again InterForm400 will keep executing sequence lines even if you move or delete the spooled file.
(in 2010 versions you will only get an info message in the AFC joblog - no MSGW).

Just to follow up on the setup above that does not work.. You might ask yourself hmmm.... What would it take to change it into something that would work...? Well you could e.g. use the 9=Exit function to make sure that the 6=Hold is not executed for the DEMO form type:

0001    8     DEMO                                                         
              Call, program: RUNSFI library: APF3812 User profile AFCOPER 
0002    9     DEMO
              Exit 
0003    *     Handle reprint:                                              

0004    1     COPY                                                         
              Merge, Overlay: IF400DEMO Fileset: SAMPLE                    
0005    *     Handle first time print:            

0006    1     NO_COPY                                                        
              Merge, Overlay: IF400DEMO Fileset: SAMPLE                      
0007    8     NO_COPY                                                        
              Call, program: ARCHIVE library: MYLIB User profile AFCOPER  
0008    6                       
              Hold Spooled File

9=Exit is also not known to many, but it will make AFC ignore the spooled file triggered for any other sequence lines that follows.