Tag Archives for " #snippet "

Update an IBM i file with SQL cursor using SQLRPGLE WHERE CURRENT OF

Using SQL in RPGLE programs is easier than you think. Making the move from RPG native file IO to SQL database IO is really quite straightforward. Ā Changing from good old READE loops to SQL FOR Loops simply means using the SQL CURSOR function. SQL has a groovy way of referring to what the stuff that […]

Continue reading

How to Debug HTTPAPI RPG Programs – dsplnk ‘/tmp/httpapi_debug.txt’

If you are using the IBM i HTTPAPI (LIBHTTP) opensource utilities, you already realize how easy it is to talk to an internet webservice from within your IBM i RPG programs. But sometimes even the best laid plans go wrong and thats when you need to learn how about the “debug HTTPAPI webservices” function. Assuming […]

Continue reading

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 […]

Continue reading

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 ‘)

Continue reading

RPG Evolution, Modernization and Refactoring – Step 5 of 4 – RPG FREE FORMAT 2017

Convert it to RPG FREE FORMAT — RPG EvolutionĀ 2017 style That’s right — this is step five of four. Much like RPG evolution, the modern day free-form RPG code is way more advanced than earlier neanderthal column based RPG. The original code blog was way back in 2009, but RPG has quietly been improving all […]

Continue reading

Dirty RPG programmers need to write Clean RPG Code

This morning I was revisiting a program that I wrote last year and looking at my code thinking “Why the hell did I write it like that? #Ugly”. RPG code evolves and lots of code evolution starts in one direction and then branches off, drunkenly in another direction. This means that code can evolve to […]

Continue reading
1 2 3 4