Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Help with Ghostscript commands (gsprint)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Help with Ghostscript commands (gsprint)
 Login/Join
 
Platinum Member
posted
Has anyone used Ghostscript commands (gsprint or gswin32c) before?

I am trying to use ghostscript gsprint command to print workorder(s) to a specified printer. We are in the process of migrating UNIX to Windows Server 2003.
In UNIX the below code worked perfectly. The users where able to print a work order to multiple work orders. Now that WebFOCUS migrated to Windows I am tring to use ghost script but it seems like it only allows me to print one work order and gives an error when I try to print multiple work orders. The printer is set up correctly and we just updated the driver on the printer to handle postscript.

I am using &EXITRC to determine if it printed or not and when I try multiple work orders it comes back as 1 instead of 0.

I am pretty much just changing any UNIX commands to Window commands (WNNIT). I also tried using gswin32c commands and that didnt work either.

Below is the code:

-DEFAULTS &BATCH_PRINTER = 'GTC164LJ01'
-DEFAULTS &SYS_I_LIST = '539236,458923,459458'
-DEFAULTS &SYS_I_COUNT = 3;

-DEFAULTS &OUTPUT=PS
-SET &PRINTER = '&BATCH_PRINTER.EVAL';
-SET &OUTPUT = '&OUTPUT.EVAL';
-SET &USERID = '&galloid.EVAL';
-SET &CNTR = &SYS_I_COUNT.EVAL;
-SET &SYS_I = &SYS_I_LIST;
SET PSPAGESETUP = ON

SET MSG=OFF
SET EMGSRV=OFF

-SET &SYS_I.&CNTR = GETTOK(&SYS_I, &SYS_I.LENGTH,(&CNTR), ',',&SYS_I.LENGTH, A6);
-TYPE &SYS_I.&CNTR

-SET &PRINTERRORS = 'An error occured for the following file: ';
-SET &LOG= 'D:\ibi76\wmgtmp\IBI_wmg0001-batch_printing\workorder_log.log';
-SET &DIR = 'D:\ibi76\wmgtmp\IBI_wmg0001-batch_printing\';
-SET &ERRORS = &DIR | 'errors.log';

-* Start of Loop
-TOPOFIT
-IF &CNTR EQ &SYS_I_COUNT.EVAL GOTO SKIPREMOVE;

-SKIPREMOVE
-IF &CNTR LE 0 GOTO ENDOFIT;
-SET &SYS_I.&CNTR = GETTOK(&SYS_I, &SYS_I.LENGTH,(&CNTR), ',',&SYS_I.LENGTH, A6);
EXEC WMG0001 OUTPUT=&OUTPUT, SYS_I=&SYS_I.&CNTR, HTYPE='HOLD', USERID= &USERID
-RUN

-SET &FNAME = &SYS_I.&CNTR || pdf.ps;
-SET &PATH = &DIR | &FNAME;

-********UNIX Commands***********************
-UNIX lp -d&PRINTER -onb -ops3 &PATH 2>> &ERRORS
UNIX rm &PATH
*********************************************

-********New Window Commands*****************
-WINNT gsprint -printer &PRINTER &PATH >> &ERRORS
APP DELETEF &PATH

***********************************************

-SET &PRINTRC = &EXITRC;
-SET &PRINTERRORS = IF &PRINTRC NE 0 THEN &PRINTERRORS || &SYS_I.&CNTR ELSE &PRINTERRORS;

-IF &PRINTRC NE 0 THEN GOTO ENDOFIT;

-SET &CNTR= &CNTR - 1;
-GOTO TOPOFIT
-* End of Loop

-SET &DESC = IF &PRINTRC EQ 0 THEN 'Your Work Order(s) have been sent to the printer ( &PRINTER.EVAL ).'
- ELSE 'Your Work Order(s) were NOT printed on printer ( &PRINTER.EVAL ).Error Code: &PRINTRC.EVAL' ;
-SET &PRINTMSG = IF &PRINTRC NE 0 THEN 'Printer is &PRINTER.EVAL' ELSE ' ';
-SET &COLOR = IF &PRINTRC NE 0 THEN 'COLOR=RED,' ELSE ' ';
-SET &PRINTERRORS2 = IF &PRINTRC NE 0 THEN &PRINTERRORS ELSE ' ';
-RUN

DEFINE FILE WMGWO01_WRK_ORD
WO_PAD/A10 = WRK_ORD_I;
WO_PAD_A/A5 = EDIT(WO_PAD,'99999');
YR/A2 = EDIT(REQ_YR_N,'$$$99');
THE_WO/A13 = YR||'-'||WO_PAD;
DT2/HMDYYIA = HGETC ( 8, 'HMDYYIA' ) ;
END

TABLE FILE WMGWO01_WRK_ORD
PRINT
DT2 THE_WO
COMPUTE RECCTR/I2 = IF RECCTR GE 210 THEN 1 ELSE RECCTR + 1;
ROWCTR/I2 = IF RECCTR EQ 1 OR 31 OR 61 OR 91 OR 121 OR 151 OR 181 OR 211
THEN 1 ELSE ROWCTR + 1;
COLCTR/I1 = IF RECCTR LT 31 THEN 1 ELSE
IF RECCTR LT 61 THEN 2 ELSE
IF RECCTR LT 91 THEN 3 ELSE
IF RECCTR LT 121 THEN 4 ELSE
IF RECCTR LT 151 THEN 5 ELSE
IF RECCTR LT 181 THEN 6 ELSE
IF RECCTR LT 211 THEN 7 ELSE 8;
PGECTR/I5 = IF RECCTR EQ 1 THEN PGECTR + 1 ELSE PGECTR;
ON TABLE HOLD
WHERE SYS_I IN (&SYS_I_LIST);
END
-RUN

TABLE FILE HOLD
HEADING
"Page ""WMG0001-batch"
"Work Order"
" "
" "
" "
" "
" "
" "
"&DESC"
"&PRINTERRORS2"
SUM THE_WO AS ''
BY PGECTR NOPRINT PAGE-BREAK
BY ROWCTR NOPRINT
ACROSS COLCTR NOPRINT

ON TABLE SET NODATA ' '
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=HEADING, STYLE=BOLD, JUSTIFY=LEFT,SIZE=9,$
TYPE=HEADING, LINE=2, JUSTIFY=LEFT,$
TYPE=HEADING, LINE=3, JUSTIFY=RIGHT,$
TYPE=HEADING, LINE=4, JUSTIFY=CENTER,$
TYPE=HEADING, LINE=5, JUSTIFY=LEFT,$
TYPE=HEADING, LINE=6, JUSTIFY=LEFT,$
TYPE=HEADING, LINE=7, JUSTIFY=LEFT,$
TYPE=HEADING, LINE=8, JUSTIFY=LEFT,$
TYPE=HEADING, LINE=9, JUSTIFY=LEFT,$
TYPE=HEADING, LINE=11,JUSTIFY=CENTER,&COLOR $

TYPE=REPORT, PAGESIZE='SCREEN',
UNITS=IN,
SQUEEZE=OFF,
SIZE=10,
GRID=OFF,
TOPMARGIN=0.01,
BOTTOMMARGIN=0.01,
TOPGAP=0.02,
BOTTOMGAP=0.02,
RIGHTGAP=0.03,
LEFTGAP=0.03,$
TYPE=TITLE,STYLE=-UNDERLINE,$
ENDSTYLE
END
-RUN
-EXIT

This message has been edited. Last edited by: Kerry,


Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats
 
Posts: 121 | Location: California | Registered: June 19, 2008Report This Post
Expert
posted Hide Post
I would be very careful of deleting the file straight after printing it.

What happens if you delay or don't delete file file ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Waz,

I did remove APP DELETEF &PATH before you replied to my post but it still doesn't work. How can I delay each print job? I looked online for an example on how to do this and couldnt find anything.


Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats
 
Posts: 121 | Location: California | Registered: June 19, 2008Report This Post
<JG>
posted
In WebFOCUS a delay is introduced using the SLEEP command

i.e. SLEEP 5

Put a -RUN after it to make sure the stack is executed.

This means do not do anything for 5 seconds
 
Report This Post
Platinum Member
posted Hide Post
JG,

Let me give it a try and i will let you know how it went.


Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats
 
Posts: 121 | Location: California | Registered: June 19, 2008Report This Post
Platinum Member
posted Hide Post
JG,

Below is the piece of code I placed in my fex file and it worked but even though I only placed a delay of 2 seconds it takes a long time to print 25 work orders. I even tried 1 second delay and it takes a long time. But it works! It's wierd when we were using UNIX commands before we switched to Windows it used to print the work orders fast.

The only downside is when the users needs to print 80 work orders its going to take a long time but its better then printing each work individually.

Thank you so much for your help.

CODE:

SLEEP 2
-RUN


Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats
 
Posts: 121 | Location: California | Registered: June 19, 2008Report This Post
Expert
posted Hide Post
Can you prepare all the work orders in one go, save them somewhere, then spawn a second process to print them.

You are certainly hitting the differences between UNIX and Windows.

you aren't able to send the reports directly to the printer ?, create the report in postscript format ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Waz,

What I am doing is just printing one work order at a time by just looping through the code. From our application the user can select multiple work orders then it sends the batch printer they select and the unique work orders to the fex file which it loops through each work order.

Right now I am hitting against Windows. We were using UNIX which is was working perfectly fine but they wanted to move from UNIX to Windows Server 2003. The code I pasted above was just showing the difference in code from UNIX and Windows.

Yes, I am able to send the reports directly to the printer.

Yes, the report is in postscript format.


Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats
 
Posts: 121 | Location: California | Registered: June 19, 2008Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Help with Ghostscript commands (gsprint)

Copyright © 1996-2020 Information Builders