Newsletters Subscriptions Media Kit About Us Contact Search Home

mgo
OS/400 Edition
Volume 3, Number 59 -- September 5, 2003

Retrieve Command Source


Hey, Ted:

I know how to retrieve the source code of a CL program (an OPM CL program, anyway). Is there a way to retrieve the source for a command?

--Bill


There's no RTVCMDSRC in OS/400, Bill, but if you don't mind getting your hands dirty, you might try the QCDRCMDD (retrieve command definition) API. It doesn't retrieve command source code; rather, it writes XML code to a stream file.

This is not an easy API to get working. The error messages give you generic information. For instance, error CPE3021 says, "The value specified for the argument is not correct." But it doesn't tell you which argument has the incorrect value.

I stumbled along, however, and eventually was able to generate XML for the GENDDL command, which I published in the June 5, 2002, edition of this newsletter. Here's my CL code:

pgm

   dcl  &cmd      *char     20
   dcl  &destinfo *char     64
   dcl  &destfmt  *char      8  value('DEST0200')
   dcl  &rcvvar   *char      1
   dcl  &rcvfmt   *char      8  value('CMDD0100')
   dcl  &error    *char     16  value(x'00000000')
   dcl  &null2    *char      2  value(x'0000')
   dcl  &null3    *char      3  value(x'000000')
   dcl  &null10   *char     10  value(x'00000000000000000000')

   chgvar  &cmd                  value('GENDDL    *LIBL')
   chgvar  %bin(&destinfo  1  4) value(0)       /* CCSID         */
   chgvar  %sst(&destinfo  5  2) value(&null2)  /* country       */
   chgvar  %sst(&destinfo  7  3) value(&null3)  /* language      */
   chgvar  %sst(&destinfo 10  3) value(&null3)  /* reserved      */
   chgvar  %bin(&destinfo 13  4) value(0)       /* path type     */
   chgvar  %bin(&destinfo 17  4) value(22)      /* path name len */
   chgvar  %sst(&destinfo 21  2) value('/')     /* delimiter     */
   chgvar  %sst(&destinfo 23 10) value(&null10) /* reserved      */
   chgvar  %sst(&destinfo 33 32) value('/home/tholt/genddl.xml')

   call qcdrcmdd (&cmd &destinfo &destfmt +
                  &rcvvar &rcvfmt &error)

endpgm

After running my program, I FTP'd the generated stream file to my PC and opened the stream file in a Web browser. Here's what I saw:

- <QcdCLCmd DTDVersion="1.0">
- <Cmd CmdName="GENDDL" CmdLib="__LIBL" CCSID="37" 
   Prompt="Generate SQL DDL" MaxPos="99" MsgF="QCPFMSG" 
      MsgFLib="__LIBL" ExecBatch="YES" ChgCmdExit="NO" 
	     RtvCmdExit="NO">
 <Parm Kwd="OBJECT" PosNbr="1" KeyParm="NO" Type="CHAR" 
   Min="1" Max="1" Prompt="Object name" Len="258" Rstd="NO" 
      AlwUnprt="YES" AlwVar="YES" Expr="YES" Full="NO" 
	     DspInput="YES" Choice="Character value" /> 
 <Parm Kwd="OBJECTLIB" PosNbr="2" KeyParm="NO" Type="CHAR" 
   Min="1" Max="1" Prompt="Object library" Len="258" Rstd="NO" 
      AlwUnprt="YES" AlwVar="YES" Expr="YES" Full="NO" 
	     DspInput="YES" Choice="Character value" /> 
- <Parm Kwd="OBJECTTYPE" PosNbr="3" KeyParm="NO" Type="CHAR" 
   Min="1" Max="1" Prompt="Object type" Len="10" Rstd="YES" 
      AlwUnprt="YES" AlwVar="YES" Expr="YES" Full="NO" 
	     DspInput="YES" Choice="TABLE, VIEW, ALIAS..." >
- <Values>
 <Value Val="TABLE" />
 <Value Val="VIEW" />
 <Value Val="ALIAS" />
 <Value Val="CONSTRAINT" />
 <Value Val="FUNCTION" />
 <Value Val="INDEX" />
 <Value Val="SCHEMA" />
 <Value Val="TRIGGER" />
 <Value Val="TYPE" />
 </Values>
 </Parm>
 <Parm Kwd="SRCFILE" PosNbr="4" KeyParm="NO" Type="NAME" 
   Min="1" Max="1" Prompt="Source physical file" Len="10" 
      Rstd="NO" AlwUnprt="YES" AlwVar="YES" Expr="YES" 
	     Full="NO" DspInput="YES" Choice="Name" /> 
- <Parm Kwd="SRCLIB" PosNbr="5" KeyParm="NO" Type="NAME" 
   Min="1" Max="1" Prompt="Source library" Len="10" Rstd="NO" 
      AlwUnprt="YES" AlwVar="YES" Expr="YES" Full="NO" 
	     DspInput="YES" Choice="Name, *CURLIB, *LIBL">
- <SpcVal>
 <Value Val="*CURLIB" MapTo="*CURLIB" /> 
 <Value Val="*LIBL" MapTo="*LIBL" />
 </SpcVal>
 </Parm>
- <Parm Kwd="SRCMBR" PosNbr="6" KeyParm="NO" Type="NAME" 
   Min="1" Max="1" Prompt="Source member" Len="10" Rstd="NO" 
      AlwUnprt="YES" AlwVar="YES" Expr="YES" Full="NO" 
	     DspInput="YES" Choice="Name, *FIRST, *LAST">
- <SpcVal>
 <Value Val="*FIRST" MapTo="*FIRST" /> 
 <Value Val="*LAST" MapTo="*LAST" />
 </SpcVal>
 </Parm>
- <Parm Kwd="CRTSRC" PosNbr="7" KeyParm="NO" Type="CHAR" 
   Min="0" Max="1" Prompt="Create file and/or member?" Len="4" 
      Rstd="YES" Dft="*NO" AlwUnprt="YES" AlwVar="YES" 
	     Expr="YES" Full="NO" DspInput="YES" Choice="*YES, *NO">
- <SpcVal>
 <Value Val="*YES" MapTo="1" /> 
 <Value Val="*NO" MapTo="0" />
 </SpcVal>
- <Values>
 <Value Val="*YES" /> 
 <Value Val="*NO" /> 
 </Values>
 </Parm>
- <Parm Kwd="REPLACE" PosNbr="8" KeyParm="NO" Type="CHAR" Min="0" 
   Max="1" Prompt="Replace or append to source?" Len="8" Rstd="YES" 
      Dft="*APPEND" AlwUnprt="YES" AlwVar="YES" Expr="YES" Full="NO" 
	     DspInput="YES" Choice="*REPLACE, *APPEND">
- <SpcVal>
 <Value Val="*REPLACE" MapTo="1" /> 
 <Value Val="*APPEND" MapTo="0" />
 </SpcVal>
- <Values>
 <Value Val="*REPLACE" /> 
 <Value Val="*APPEND" />
 </Values>
 </Parm>
 </Cmd>
 </QcdCLCmd>

It's not pretty, but the information is there. As far as I know, there is no way to convert the XML to command source, but I hope somebody writes in and proves me wrong.

--Ted


Sponsored By
GST

AIT Backup for iSeries

GST, Inc.
Phone: 866-478-4621 or 949-900-1090 (for sales x 300)
Web: http://www.gstinc.com
Email: sales@gstinc.com

---------------------------------------------------------------------

SUMMARY

Compact, modular and reliable backup solution at unbeatable prices

· Powerful 3lb drive in small form factor
· LCD module for backup effiency
· Capacity up to 200GB
· Speed up to 865GB/hour
· LVD, HVD, and fibre connectivity
· Starts at $2,000 USD

---------------------------------------------------------------------

THE BIG PICTURE

· A single AIT tape drive in external, modular, stackable enclosure.
· Capacity: AIT-3 100GB native (200 GB compressed).
· Speed: AIT-3 43GB/hour native (86GB/hour compressed).
· Single subsystem is field-upgradeable to dual drive subsystem.
· LCD display panel improves backup efficiency.
· Supports AIT-1, AIT-2 and AIT-3.
· Roadmap to AIT-4, AIT-5, AIT-6.
· AIT range: single drive to enterprise-wide libraries.
· Supports LVD and HVD SCSI connections directly.
· Supports Fibre Channel via our bridges and routers.

The Single AIT Tape Subsystem is part of GST's EntryDR™ family. Single AIT Tape Subsystems are housed in upgradeable modular enclosures. This subsystem delivers high-performance and high reliability at cost-effective pricing to meet basic backup needs for the small to medium range of servers.

Building-block modularity enables the Single AIT Tape Subsystem to be upgraded to GST's Dual AIT Tape Subsystem to strengthen disaster recovery protection. An LCD panel provides an advanced operator interface for visibility over the backup operation.

The Single AIT Tape Subsystem can backup IBM eServer family members: iSeries, pSeries and xSeries servers. They connect natively with LVD (low voltage differential) and HVD (high voltage differential) SCSI connections, and with Fibre Channel (FC) through our BridgeLink™ family of bridges and SanMatrix™ family of routers.Model overview.

GST's Single AIT Tape Subsystem is available in a variety of models. Each AIT technology (AIT-1, AIT-2, AIT-3) is available in two server-to-SCSI Adapter interfaces:

LOW VOLTAGE DIFFERENTIAL (LVD). Connectivity with eServer family. iSeries uses IBM SCSI Adapter feature code: FC 5702, 5705. pSeries and xSeries servers use a variety of LVD SCSI adapters.

HIGH VOLTAGE DIFFERENTIAL (HVD). Connectivity with eServer family. iSeries uses IBM SCSI Adapter feature code: FC 2729, 2749, 6501, 6534. pSeries and xSeries servers use a variety of HVD SCSI adapters.

AIT TECHNOLOGY

AIT tape technology has evolved through three generations: AIT-1, AIT-2 and AIT-3 and provides outstanding capacity and performance with a highly stable technology roadmap. AIT cartridges utilize Memory-in-Cassette (MIC) architecture providing rapid time-to-data and multiple load points for partitioning data.

Native cartridge capacities for AIT-1, AIT-2 and AIT-3 are 35GB, 50GB and 100GB (70GB, 100GB, 200GB compressed) with speeds of 14GB/hour, 22GB/hour and 43GB/hour (28GB/hour, 44GB/hour and 86GB/hour compressed). Scalability is planned to a 6th generation product with native capacity of 800GB (1.6TB compressed) and a speed of 345GB/hour (690GB/hour compressed). A 2-to-1 compression ratio is achieved with Adaptive Lossless Data Compression (ALDC) technology.

KEY BENEFITS

DUAL DRIVE UPGRADE - A second modular drive and controller can be added later to upgrade to a Dual AIT Tape Subsystem as backup needs evolve that require DR protection, fault tolerant backup or greater unattended backup capacity.

HARDWARE INVESTMENT PROTECTION - The modular design of the Single AIT Tape Subsystem protects user investment by permitting the original single drive unit to be retained unmodified as part of the upgraded Dual AIT Tape Subsystem.

SPACE SAVER - The small dimensions and weight of the modular configurations facilitate the optimum use of datacenter space.

MEDIA INVESTMENT PROTECTION - For IT sites with an investment in AIT-1 media and drives, the newer AIT-2 and AIT-3 technologies are backward-read compatible, and forward-read compatible to future generations.

SERVICEABILITY - Modularity of design permits individual drives to be easily replaced in building-block fashion by the user.

KEY FEATURES

STACKABLE ENCLOSURES - Individual modular enclosures enable each drive and the mirrored backup controller to be handled as separate building blocks; facilitates field upgrade from single to dual drives.

LCD DISPLAY PANEL - Multi-function LCD continuously displays drive and backup status.

CONVENIENT DRIVE INTERFACE - RS232 interface for updating firmware and optimizing drive performance.

SERVICE AND SUPPORT - A variety of support programs provide installation and onsite service; includes GST's Accelerated Ship Program (GASP) to get replacement units on the scene rapidly.

WARRANTY - Purchase price includes a built-in manufacturer's warranty of three years.

GST, Inc.
Phone: 866-478-4621 or 949-900-1090 (for sales x 300)
Web: http://www.gstinc.com
Email: sales@gstinc.com


THIS ISSUE
SPONSORED BY:

Advanced Systems Concepts
GST


BACK ISSUES

TABLE OF
CONTENTS

Not All Outer Joins Are Equal

Retrieve Command Source

Reader Feedback and Insights: No Field Reference File, No Problem


Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris
Shannon O'Donnell

Managing Editor
Shannon Pastore

Publisher and
Advertising Director:

Jenny Thomas

Advertising Sales Representative
Kim Reed

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.