Category Archives for "AS400"

Sep 25

How to debug an as400 CLP or RPG opm or ILE job in batch sub system

another old snippet from an ancient document I found in a dim dark and hazy corner of an even older and crustier HDD… rather than let it disintegrate, here it is migrating to the web just in the (extreme) off chance that it may be useful to someone out there…. 😉

 

Debug a program in BATCH.

 

1.    Hold the JobQ (Eg: QBATCH)

2.    Submit the job.

3.    Hold the job – Take option 3 against the job in “Work with submitted jobs”.

4.    Release the JobQ

5.    Take option 5 against the job to be debugged and make a note of the “Job Name”, “User”, and “Job Number”.

6.    Execute the command STRSRVJOB – Start Service Job. Input the Job Name, User, Job Number.

7.    STRDBG – Start Debug.

More Waffle
Sep 13

Varying Length fields in DDS and IBM i SQL

Back in the olden days – files were filled with numbers and long string of data. Words like SAUSAGES might have been stored as a 30 ALPHA field in the format “SAUSAGES______________________” which, even tho its padded with *blanks – is just wasting a lot of space. Nowadays, most systems use variable length fields, shorter, […]

More Waffle
Aug 17

Scan Replace in RPGLE and SQLRPGLE

In the middle of this RPG program, I want to reformat and replace some values in a big long address field. But for the life of me… I cant remember how to use the SCANREPLACE built in function in RPG. #Dingbat /me memory circuits need a service methinks. So, like all programmers, I wonder off to […]

More Waffle
Aug 16

IBM i gets a medieval System Reset Button

Breaking news from a medieval insider at the IBM laboratory rochest’r, mn – in ‘rd’r to bett’r competeth with the growing competition from microsoft s’rv’rs, ibm plans to installeth a big r’d did reset button on the newly did announce pow’r systems and changeth all ibm i op’rating system ‘rr’r message text to readeth “gen’ral […]

More Waffle
Aug 15

I remember the IBM AS400

Discussing a data interchange process with a software vendor today (who shall remain nameless), they told me that their product could talk to an AS400 but had no experience of iSeries or IBM i…. *sigh* I am not telling you the company name because I don’t wan to  to embarrass them in public… but if […]

More Waffle
Aug 11

How to ZIP AS400 library and Email it

Now, before you get all bent out of shape and point your grubby little index finger at me cackling “you called it an AS400 na-na-nu-na-naaah“, I do have a legitimate reason. It’s a shallow SEO based one (the grey haired brigade keep searching for “zip AS400 library”) but it’s legitimate. I only used the wrong […]

More Waffle
Aug 08

RPG Program Source Code – Clever or Clear?

I’ve been working on an interesting project focused on taking some old RPG code and re-factoring it to make it more efficient. Fascinating work for a client that is focused on doubling its IBM i throughput and reducing the CPU load of all its old programs. This has frequently made me choose between writing a […]

More Waffle
Aug 04

GETSPLF and PUTSPLF – read and write spools to physical files including all Advanced Function Printing Data Stream (AFPDS)

wow – that has got to be the longest url yet   😉

 

QSPGETF AND QSPPUTF APIs AND COMMANDS

IBM Knowledgebase item 8011926 describes two APIs that are undocumented in the AS/400 manuals. The two APIs, Get Spooled File (QSPGETF) and Put Spooled File (QSPPUTF), copy spool files to and restore them from physical files, respectively. The advantage of QSPGETF and QSPPUTF over the well-documented Copy Spooled File command (CPYSPLF) is that the APIs are able to copy Advanced Function Printing Data Stream (AFPDS) and Intelligent Printer Data Stream (IPDS) spool files, whereas CPYSPLF cannot.

You can call the QSPGETF and QSPPUTF APIs directly, or you can call them using command wrappers over the APIs.

  • Calling the APIs Directly

The QSPGETF API call below saves spool file QPRINT to database file SPOOLDB in USER1LIB library, member MBR1, where the spool file number is 1 and the spool file job is 010160/user1/dsp03:

CALL PGM(QSYS/QSPGETF) PARM(‘QPRINT ‘ ‘SPOOLDB USER1LIB ‘ ‘DSP03 USER1 010160′ X’0001’ ‘MBR1 ‘)

More Waffle