INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Spooled file staying in OPN status

Spooled file staying in OPN status

(OP)
I'm trying to do some simple label printing using ILE RPG with an embedded SQL statement. The program compiles without errors and when I run it, the spooled file stays in OPN status unless I use a CLOSE statement in the file after the WRITE. If I use the CLOSE statement, the program runs fine, once and the next time I get an error that says 'I/O operation was applied to closed file'. If I then insert an OPEN statement, the next time I run the program I get the error 'OPEN was issued to opened file'.

I know I'm missing something simple but can't figure out what it is.

Many thanks,
Derek

RE: Spooled file staying in OPN status

(OP)
Sorry, I should have thought to post the code the first time.

* SET CONNECTIONS TO EXTERNALLY DESCRIBED FILES
F*RPRT00 O E DISK
FRPRT01PR O E PRINTER
*
* Data Definitions
D LABELVARS DS
D Shipto1 5A
D WaveNo 2S 0
D BatchNo 7A
D CtrNo 11S 0
D WaveCntr 13A
*
***
*Open PRTF
C* OPEN RPRT01PR
*
C/EXEC SQL
C+ SELECT SUBSTR(SHIPTO,1,5), WAVE,
C+ BATCH, CONTAINER,
C+ DIGITS(WAVE)||DIGITS(CONTAINER)
C+ INTO :LABELVARS
C+ FROM WMSDTA/COC00
C+ WHERE CONTAINER = 1159998001
C/END-EXEC
C*Write record to printer
C WRITE MAIN
C*Close PRTF
C* CLOSE RPRT01PR
C RETURN

The source member is of type SQLRPGLE.
System is an i5 - AS/400 running V5R4

Thanks,
Derek

RE: Spooled file staying in OPN status

Indicate USROPN in the printer's F-Spec in the keywords. Without that, it doesn't know you want to control the open/close of the file.

I keep trying to do something about my procrastination but I keep putting it off until tomorrow.

RE: Spooled file staying in OPN status

(OP)
That works perfectly! Thanks very much. I had a feeling it was something small and simple.

Thanks,
Derek

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close