ASPLMQ User Guide v 1.00
© 2026 Bassem W. Jamaleddine


4-1

   ASPL MQ Writers



ASPL writers use Perl modules to process GADg or GADsop objects into formatted reports. An ASPL variable is a named set variable pointing to a GADg (Group Algebraic Data group). The GADsop is a transform of the GADg structure that internally maps each element's containment path to its group label. At the ASPL prompt, running the writeformat command by itself invokes a preselected writer against the grouping object at the top of the answer stack. The writer then loops through the group represented by that object, reading the attributes of each element to generate a formatted report. This workflow best demonstrated through a practical example.

The following four ASPL commands manage report generation via custom writer modules:
  • ~writersdir – Specifies the directory containing the active writer modules.
  • showwriteformat – Displays all writer modules currently available from within the ASPL session.
  • setwriteformat – Selects a specific writer module by name for the active session.
  • writeformat – Prints the tabulated report output using the currently selected writer.
  • This section is not included in the SAMPLE PREVIEW.
    These writer modules are specifically designed to format raw IBM MQ objects into pretty-printed tabulated reports. Copy these files to the ASPL ~writersdir directory by executing the following command:

    # cp MQ_Writer_*.pm `asplcmd ~writersdir`

    Once copied, these modules are immediately available within the ASPL interpreter. To display them, execute the showwriteformat command:

    # asplcmd showwriteformat

    
      THE WRITER FORMAT IDENTIFIER TO SELECT THE FORMATTING ROUTINE:
    
                          IDENTIFIER              GROUPINGCLASS   DESCRIPTION                      
                          ----------  -------------------------   ------------------------------------  
     >                       nothing                          *   format nothing at all     
                  MQ_Writer_Channels       IBMMQ_CHANNELS_GROUP   IBM MQ channels formatted table      
           MQ_Writer_ChannelsCmpQmgr       IBMMQ_CHANNELS_GROUP   IBM MQ channels comparative qmgrs formatted table
             MQ_Writer_ChannelsColor       IBMMQ_CHANNELS_GROUP   IBM MQ channels comparative qmgrs table with colors 
         MQ_Writer_ChannelsColorTest       IBMMQ_CHANNELS_GROUP   IBM MQ channels comparative qmgrs table with colors 
                     MQ_Writer_Qmgrs           IBMMQ_QMGR_GROUP   IBM MQ comparative qmgrs formatted table          
                MQ_Writer_QmgrsColor           IBMMQ_QMGR_GROUP   IBM MQ comparative qmgrs formatted table with colors 
            MQ_Writer_QmgrsColorTest           IBMMQ_QMGR_GROUP   IBM MQ comparative qmgrs formatted table with colors 
                MQ_Writer_QmgrsPrint           IBMMQ_QMGR_GROUP   IBM MQ comparative qmgrs formatted table with colors 
              MQ_Writer_QmgrsPrinter           IBMMQ_QMGR_GROUP   IBM MQ comparative qmgrs formatted table with colors 
                    MQ_Writer_Queues         IBMMQ_QUEUES_GROUP   IBM MQ queues formatted table               
             MQ_Writer_QueuesCmpQmgr         IBMMQ_QUEUES_GROUP   IBM MQ queues comparative Qmgrs formatted table 
               MQ_Writer_QueuesColor         IBMMQ_QUEUES_GROUP   IBM MQ queues formatted table testing with ANSI colors 
           MQ_Writer_QueuesColorTest         IBMMQ_QUEUES_GROUP   IBM MQ queues formatted table testing with ANSI colors 
               MQ_Writer_QueuesLogos         IBMMQ_QUEUES_GROUP   IBM MQ queues formatted table with logos nytesta/vatesta 
    
       CURRENTLY WRITER IS POINTING TO  nothing
       TO SET THE WRITER TO A SPECIFIC HANDLER USE setwriteformat FOLLOWED BY ONE OF THE IDENTIFIERS
    
    


    Each writer function has an identifier. Select a specific writer by running setwriteformat with the writer's identifier name, then execute writeformat to print the formatted report of the last group operation (that was pushed at the top of the answer stack).


    Executing writeformat invokes the selected writer function and passes the GADg and GADsop objects from the top of the answer stack.
    The GROUPINGCLASS column serves as a non-binding reference and is not programmatically enforced. Writer modules carry no binding to the element grouping class, allowing the underlying script to bypass and ignore any data processing errors via an internal eval block.

    The writeformat command reads the object reference of the last group
    operation pushed to the top of the answer stack, prepares the GADg and GADsop
    data structures, and passes them to the invoked writer function. The writer
    function loops over the group elements to produce a prettypint formatted report.

    To print the formatted data of a named group variable, run writeformat
    followed by the variable name.

    Display 4.1.1 provides an example of the writeformat command. In this sequence, ASPL loads IBMMQ_QUEUES before running a series of commands to prettyprint a formatted layout of the queues in acmetesta set variable.
    viewme

     Display. 4.1.1   [Examples Using ASPL for MQ Writers]
    Examples Using ASPL for MQ Writers

    ■ Coding your own MQ Writer Modules

    Writer modules are Perl modules deployed in the ASPL ~writersdir directory that process GADg and GADsop objects into formatted, tabulated reports. This section details the development of these specialized routines, collectively referred to as MQ Writers for IBM MQ qmgrs, queues, and channels.
    This section is not included in the SAMPLE PREVIEW.

     

    ■ Example of MQ Writer Module Using ANSI Colors


    Perl write templates do not render ANSI color escape sequences, printing them as raw text instead. Generating colorized output requires using standard printf and sprintf functions to handle ANSI sequences correctly.

    Located in the ASPL lib directory, the DataManagement::ANSICOLORS module provides the sprintansi() function for printing ANSI color-formatted strings. The MQ_Writer_QueuesColor.pm module (Listing 4.1.5) loads this package and imports sprintansi() to render color output. The MQ_Writer_QueuesColor() routine then outputs a tabulated report of the queues tracked inside a variable's GADsop under the IBMMQ_QUEUES_GROUP class.
    This section is not included in the SAMPLE PREVIEW.