I have the following RPG program. It runs to completion with no errors.
However, the pdf file produced is either empty or is corrupt.

I am trying to retrieve the last tape number used in BRMS.



Can anyone identify why the pdf is empty or corrupt?

The program can be run on your system if you have BRMS.

Here is my code.



**free

// -------------------------------------------------------------

// Program name : SYBCKR01

// Description : Retrieve last backup tape number and email it.

// -------------------------------------------------------------

// Modifications



// -------------------------------------------------------------



/if defined(*CRTBNDRPG)

Ctl-Opt dftactgrp(*no);

Ctl-Opt actgrp(*caller);

/endif

Ctl-Opt ALWNULL(*USRCTL);

Ctl-Opt option( *srcstmt : *nodebugio );

Ctl-Opt bnddir('QC2LE');



// --------------------------------------------------------------

// File specifications

// --------------------------------------------------------------



// --------------------------------------------------------------

// Entry parms

// --------------------------------------------------------------



Dcl-PI SYBCKR01 extpgm('SYBCKR01');

// pLib Char(10);

// pThis_System Char(10);

End-PI;



// --------------------------------------------------------------

// Local data structures

// --------------------------------------------------------------



// Dcl-DS dsUser_InfoB EXTNAME('USER_INFOB');

// End-DS;





// *************************************************************

// Externally Called procedures

// *************************************************************

Dcl-PR QCMDEXC EXTPGM('QCMDEXC');

Cmd Char(3000) OPTIONS(*VARSIZE);

CmdLen Packed(15:5) CONST;

CmdDbcs Char(3) CONST OPTIONS(*NOPASS);

End-PR;

// *************************************************************



Dcl-S wCmd Char(3000);

Dcl-S wCmdLen Packed(15:0);

Dcl-S wCount int(10);



Dcl-S wObj Char(10) ;

Dcl-S wObj_Lib Char(10) ;

Dcl-S wObj_Type Char(10) ;



Dcl-S wQ Char(1) INZ('''');



Dcl-S Today char(6) ;

Dcl-S Email_Body Char(256) ;

Dcl-S wEmail_Response Char(5) ;



// *************************************************************

// dsQsrc e ds extname(QSRC)

// *************************************************************

// Start of sub Procedures

// *************************************************************



/copy dfreinkel/qrpglesrc,cpy_set



Today = %char(%date():*MDY0) ;



wCmd = 'CHGJOB LOG(4 0 *SECLVL) LOGCLPGM(*YES) CCSID(37)' ;

exsr RunCmd;



wCmd = 'ERASE OBJLNK(''/tmp/Todays Tape.pdf'')' ;

exsr RunCmd;



wCmd = 'DLTOVR FILE(QP1AMM) LVL(*JOB)' ;

exsr RunCmd;



wCmd = 'DLTOVR FILE(QP1AMM) LVL(*JOB) ' ;

exsr RunCmd;



wCmd = 'OVRPRTF FILE(QP1AMM) DEVTYPE(*AFPDS) TOSTMF(''/tmp/Todays
Tape.pdf'') '

+ ' OVRSCOPE(*JOB)' ;

exsr RunCmd;



wCmd = 'WRKMEDBRM TYPE(*ALL) SLTCRTDATE('

+ %trim(TODAY)

+ ' '

+ %trim(TODAY)

+ ') VOL('

+ wQ

+ '0*'

+ wQ

+ ') OUTPUT(*PRINT) ' ;

exsr RunCmd;



Email_Body = 'Please open the PDF file and take the tape number from the
Volume Serial column. '

+ 'That is todays tape to remove from the tape system. ';



Exec Sql

VALUES SYSTOOLS.SEND_EMAIL(

TO_EMAIL => 'dfreinkel@xxxxxxxxxxxxxxxxxx',

SUBJECT => 'Todays Tape number to remove from the tape system',

BODY => :Email_Body,

ATTACHMENT => '/tmp/Todays Tape.pdf' ) into :wEmail_Response;



wCmd = 'DSPJOBLOG OUTPUT(*PRINT) ' ;

exsr RunCmd;



*inlr = *on;



// --------------------------------------------------------------

// RunCmd - execute a CL command

// --------------------------------------------------------------



Begsr RunCmd;



wCmdLen = %len(%trim(wCmd));

monitor;

qCmdExc(wCmd:wCmdLen);

on-error;

endmon;



snd-msg *info wCmd ;



EndSr;

// --------------------------------------------------------------









Darryl Freinkel

A4G

Telephone: 770.321.8562




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.