Break the *PRTF 378 Character Limit with a Custom *WSCST

Break the *PRTF 378 Character Limit with a Custom *WSCST

I had a situation where I was printing a PDF417 barcode to a SATO printer. The data for the barcode contained a name, an address, and other information and together it was longer than 378 characters. 378 is the maximum record length for a printer file. OS/400 printing services will insert a carriage return/linefeed (x’0D’/x’0A’) when 378 is reached.

This x’0D’/x’0A’ skewed the PDF417 data. What I needed was a continuous stream of data.

Changing the behavior of a printer device can often be accomplished by using a custom Workstation Customizing object (*WSCST). A *WSCST object is like a filter that the data stream passes through on its way to the printer device. By changing this “filter” you can alter the printed output (e.g. print to drawer 2, change the font, etc.).

To remove those two characters from the data stream I created a workstation customizing object (*WSCST) that replaced them with no characters. I then changed the device description of the SATO printer to use this new object and, voila, I was in business.

Here is a before and after view of the *WSCST object’s specification. Note the changes to :CARRTN and :LINEFEED:

Before:

:WSCST DEVCLASS=TRANSFORM. 
                           
    :TRNSFRMTBL.           
    :INITPRT               
      DATA ='00'X.         
    :SPACE                 
      DATA ='20'X.         
    :CARRTN                
      DATA ='0D'X.         
    :FORMFEED              
      DATA ='0C'X.         
    :LINEFEED              
      DATA ='0A'X.         
:EWSCST.                   

After:

:WSCST DEVCLASS=TRANSFORM.
                          
    :TRNSFRMTBL.          
    :INITPRT              
      DATA ='00'X.        
    :SPACE                
      DATA ='20'X.        
    :CARRTN               
      DATA =''X.          
    :FORMFEED             
      DATA ='0C'X.        
    :LINEFEED             
      DATA =''X.          
:EWSCST.                  

To produce this *WSCST I first retrieved the source of an existing *WSCST using command RTVWSCST, then I modified that source in an editor, then compiled that source using command CRTWSCST, thereby creating my custom *WSCST object.

RTVWSCST has many printer device types and models from which to choose. Since I was writing to QSYSPRT I used *TRANSFORM for the device type and *WSCSTCONT132 for the model. If you were working with, say, a laser printer that had an HP driver you would probably choose *HP4 instead of *WSCSTCONT132.

Once I created the *WSCST object via CRTWSCST I changed the device description of the printer to use that object. Note, this will employ the *WSCST object for every print job sent to that device. If you don’t want that behavior then you would not change the device description and instead make use of command OVRPRTF in your program.

Here are the steps in detail:

  1. Retrieve the source of an existing *WSCST:
    RTVWSCST DEVTYPE(*TRANSFORM) MFRTYPMDL(*WSCSTCONT132) SRCMBR(YOURMBRNAM) SRCFILE(YOURLIB/YOURSRCPF)
  2. Edit the source produced and remove 0D and 0A
  3. Compile the source to create the *WSCST object:
    CRTWSCST WSCST(YOURLIB/YOURWSCST) SRCFILE(YOURLIB/YOURSRCPF)
  4. Change the printer device description by specifying the *WSCST on the WSCST parameter, or use command OVRPRTF in your program:
    CHGDEVPRT DEVD(YOURPRTDEV) WSCST(YOURLIB/YOURWSCST)
    OR
    OVRPRTF MYPRTF WSCST(YOURLIB/YOURWSCST)

IBM has a video that discusses workstation customizing objects. I suggest you check it out.

Video link:
https://mediacenter.ibm.com/media/Understanding+and+Creating+Workstation+Customizing+Objects/1_a43lp5xjLink&feature=youtu.be

IBM’s Knowledge Center link for customizing WSCST of type *TRANSFORM https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzalu/rzalucustransdev.htm

IBM’s support page for modifying Workstation Customizing objects:
https://www.ibm.com/support/pages/instructions-modifying-workstation-customizing-object-wscst

Leave a Reply

Your email address will not be published. Required fields are marked *