Download Latest Version qryff.zip (7.9 kB)
Email in envelope

Get an email when there's a new version of Query for Free

Home
Name Modified Size InfoDownloads / Week
qryff.zip 2013-01-01 7.9 kB
README.TXT 2013-01-01 5.1 kB
QRYFF.PNL 2013-01-01 2.0 kB
QRYFF.SQL 2013-01-01 274 Bytes
QRYFF.CLP 2013-01-01 12.2 kB
QRYFF.RPG 2013-01-01 9.2 kB
QRYFF.CMD 2013-01-01 3.0 kB
Totals: 7 Items   39.8 kB 0
	README

	Query for Free (QRYFF)

ABOUT

	Query for Free (QRYFF) is an interface to the IBM SQL database engine.
	You can do anything that the operating system allows in an interactive
	SQL command.  This tool allows you to quickly and easily view and
	manipulate iSeries data from the command line.  You can view, update,
	delete, and insert records.  You can join files, alter field definitions,
	summarize, group, order - anything your imagination and the iSeries
	SQL system will allow.

FILES

	QRYFF.CLP	Control Language Program source member
	QRYFF.CMD	Command source member
	QRYFF.PNL	Panel source member for command help
	QRYFF.RPG	RPG source member
	QRYFF.SQL	Query Management Query source member
	README.TXT	This file

INSTALL

	Download the file qryff.zip to your PC.

	Extract (unzip) the files to a directory on your PC.

	Copy the QRYFF.* files to a folder in your iSeries hierarchical file system (HFS).
	To do this on my system:
		o  Go to the Windows "Run" prompt
		o  Type \\PGMR and press Enter
		o  Select the folder you want to use to temporarily store the
		   source members.  I am going to use \\PGMR\QUMB\TEMP

	Copy the unzipped source members from your PC to the HFS folder of your 
	choice. Note that you must use a compatible main folder of the HFS. HFS
	sub-folders have attributes that determine how data is stored. I recommend
	using either QDLS or QUMB as the main folder.

	On the iSeries, copy the files from the documents folder to your source
	file member. For example:

		CPYFRMPCD FROMFLR('TEMP') TOFILE(yourlib/QCLSRC)
		FROMDOC(QRYFF.CLP) TOMBR(QRYFF)

		CHGPFM FILE(yourlib/QCLSRC) MBR(QRYFF) SRCTYPE(CLP)
		TEXT('Query for Free')

		CPYFRMPCD FROMFLR('TEMP') TOFILE(yourlib/QRPGSRC)
		FROMDOC(QRYFF.RPG) TOMBR(QRYFFR)

		CHGPFM FILE(yourlib/QRPGSRC) MBR(QRYFFR) SRCTYPE(RPG)
		TEXT('Query for Free')

		CPYFRMPCD FROMFLR('TEMP') TOFILE(yourlib/QQMQRYSRC)
		FROMDOC(QRYFF.SQL) TOMBR(QRYFF)

		CHGPFM FILE(yourlib/QQMQRYSRC) MBR(QRYFF) SRCTYPE(QMQRY)
		TEXT('Query for Free')

		CPYFRMPCD FROMFLR('TEMP') TOFILE(yourlib/QPNLSRC)
		FROMDOC(QRYFF.PNL) TOMBR(QRYFF)

		CHGPFM FILE(yourlib/QQMQRYSRC) MBR(QRYFF) SRCTYPE(PNLSRC)
		TEXT('Query for Free')

		CPYFRMPCD FROMFLR('TEMP') TOFILE(yourlib/QCMDSRC)
		FROMDOC(QRYFF.CMD) TOMBR(QRYFF)

		CHGPFM FILE(yourlib/QCMDSRC) MBR(QRYFF) SRCTYPE(CMD)
		TEXT('Query for Free')

	Compile the source. Specify your source and object libraries as desired.

		CRTCLPGM PGM(QRYFF) SRCFILE(QCLSRC)

		CRTRPGPGM PGM(QRYFFR) SRCFILE(QRPGSRC)

		CRTQMQRY QMQRY(QRYFF) SRCFILE(QQMQRYSRC)

		CRTPNLGRP PNLGRP(QRYFF) SRCFILE(DEVSRC/QPNLSRC)

		CRTCMD CMD(QRYFF) PGM(QRYFF) SRCFILE(QCMDSRC)
		HLPPNLGRP(QRYFF) HLPID(QRYFF)

USAGE EXAMPLES
	
	QRYFF SQLEXPR('SELECT * FROM cafiles/msvml100
		WHERE vname LIKE ''%ZACKY%''')
		MEMBER((MSVML100 M600))
		/* Display query to screen */
	
	QRYFF SQLEXPR('SELECT vndno,vname FROM cafiles/msvml100
		WHERE vname LIKE ''%ZACKY%''')
		MEMBER((MSVML100 M600)) 
		OUTPUT(*PRINT) PRTTXT('Short vendor listing') PAGEWIDTH(80)
		/* Print query report */

	QRYFF SQLEXPR('SELECT vndno,vname,vstat FROM cafiles/msvml100 
		WHERE vname LIKE ''%ZACKY%''')
		MEMBER((MSVML100 M600))
		OUTPUT(*OUTFILE)             
		/* Write query records to default output file */
	QRYFF 'SELECT * FROM qtemp/qryout'                                       
		/* Display records in the default output file */

	QRYFF 'CREATE TABLE qtemp/slnos                                   
		(Ranch          FOR COLUMN rhno DECIMAL(3),               
		Marketing_Count FOR COLUMN mkct DECIMAL(7),        
		Flock_Count     FOR COLUMN flct DECIMAL(7))'
		/* Create a file with 3 fields */

	QRYFF 'update nzgpl/pphist set phqtno=4                   
		where phqtno=3 and phweyy=2012 and phwemm=9 and phwedd=29'
		/* Fix data "on the fly" */

BUGS

	There is one small bug in QRYFF.  It has to do with quotes in the query
	string.  On rare occasions a query will complain that the syntax is 
	wrong or some other error and you can see that you have entered the 
	command in correctly.  The cause is the way CL strings handle quotes
	combined with the way the qryff string is passed to the STRQMQRY command.
	Occasionally a quote will get "messed up."  I catch most of these in the
	CL portion of the command but one will occasionally be a problem
	THE SOLUTION is simple: Simply add an extra space somewhere in the qryff
	string before the first quote.  That will usually solve the problem.

	For example, if the following query gets an error:

                qryff 'select * from ppempms where pmemnm=''SMITH''' 

	Add a space before the first qoute to get around the bug, like this:

                qryff 'select * from ppempms where  pmemnm=''SMITH'''
                                                   ^
                                                 space
	or this:

                qryff 'select *  from ppempms where pmemnm=''SMITH'''
                                ^
                              space

//END
Source: README.TXT, updated 2013-01-01