iSeries home   |   Easy400     |   CGIDEV2     |   MMAIL  
Public-Source
 
Introduction
 Command DSPSTMF
Command CMPSTMF
String Retrieve/Replace/Extract  procedures
 
 PDF of this tutorial
 
 Download
 
 

 
 
 
WrkStmf
Command DSPSTMF (Display stream file)
 

Command DSPSTMF displays a stream file in a way that makes very easy to establish a position of a string (either in character or in hexadeximal format) within the stream file.
Main features:

  • Ability to switch from the character view to the hexadecimal view of the stream file data.
  • Vertical and horizontal position axes allow to correctly establish the position of a string within the stream file.
  • String search option: the position of the string found is displayed both in decimal and hexadecimal numbers.
  • The cursor may be used to correctly establish the position of a given byte of file data.
Restrictions:
  • Stream file with Unicode CCSID 1208 are not supported.

                        Display a stream file (DSPSTMF)                        
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 Stream file  . . . . . . . . . . STMF           /wrkstmf/samples/puss_in_boots.txt'        
_________________________
 Convert data to job dft CCSID  . CVTCCSID       *YES          *YES, *NO, *CHR
                                                                                
                
Figure 1 - Command DSPSTMF
  • Stream file (STMF) - The name of the stream file to be displayed. This name must be qualified with the name of the directory in which the stream file is located.
    Note - The size of this stream file must not exceed 16 MB.
  • Convert data to job dft CCSID (CVTCCSID) - Usually a stream file has a CCSID different from the one of the job running this command. To be understood, file data need to be converted to the job CCSID.
    You may select one of the following options:
    • *YES (default) - In this case, if the job CCSID is 65535, it is temporary changed to its default CCSID, in order to support system-provided data CCSID conversion. The stream file data are then read with CCSID conversion to the job CCSID, so that the stream file ata can be displayed in the job CCSID characters and in their corresponding hexadecimal values.
    • *NO - In this case, no data CCSID conversion is performed. File data are displayed in their original bit pattern.
    • *CHR - In this case, the hexadecimal view of the data is not converted to the job CCSID, while the character view of the data is converted to the job CCSID (so that you may understand what is there).


The following displays some details of the features provided in command DSPSTMF. All the cases hereafter have been run with CVTCCSID(*YES).

  • 1. Character mode
  • 2. Display character position
  • 3. Find a character string
  • 4. Hexadecimal mode
  • 1. Character mode

    Command DSPSTMF supports two modes of stream file data display: character mode and hexadecimal mode. The initial display is in character mode and looks as follow:
    Figure 2 - Character mode
    The character mode provides pages of 1600 data characters. Use the Rollup key to display the next page, the Rolldown key to display the previous page.
    Use key F7 to display the first page, use key F8 to display the last page. You may as well type character T or character B in input field Find: ____ to reach the top or the bottom page.
    You may perform data positioning by entering your desired positioning in input field Position to: ____ and pressing the Enter key. you are then displayed the page containing that position and the cursor is moved to the position you asked for.

    2. Display character position

    To display the exact position - within the stream file - of a given character, position the cursor on it, then press key F14: the exact position is then displayed (as a decimal and as an hexadecimal number) on the top of the page, see the next figure.
    Figure 3 - Display character position

    3. Find a character string

    To find a character string, type that string in the input field Find: ____ and press key F16.
    Example: on the screen in Figure 2, or .
    If the search is successful, the page containing the search argument is displayed and the cursor is positioned in front of the searched character string. The position - where the searched character string was found - is displayed (as a decimal and as an hexadecimal number) on the top of the page, see the next figure.
    Figure 4 - Find a character string
    You may repeatedly press key F16 to find all the subsequent identical strings in the stream file.
    Note. If you want to find a character string after a given stream position, roll to the page containing that position, type the Find ___ argument, place the cursor in that position, then press F16.

    4. Hexadecimal mode

    You can switch from character to hexadecimal mode using key F10, and revert to character mode with the same key.
    The character mode provides pages of 480 data bytes. Each page contains two views: the hexadecimal and the corresponding character one.
    Figure 5 - Hexadecimal mode

    You may perform operations in both ways: in character or in hex mode. Examples:
    Desired operation Action on the char view OR action on the hex view Result for both actions
    Position the cursor to a given stream file position Type that position on input field Position to: ___ and press the Enter key. The page containing that position is displayed. The cursor moves to that position in the hex view.
    Display a character position place the curson on a character in the char view and press F14 place the cursor on a hex byte in the hex view and press F14 the position is displayed both as decimal and as hexadecimal number, the cursor remain where you moved to.
    Find a string Enter a character string in input field Find: ___ and press F16 Enter an hex string in input field Find: ___ and press F16 If find successful, the page containing that string is displayed, the found string position is shown as decimal and hexadecimal number, the cursor positions at the beginning of that string in the hex view.

    Note. The following search strings (specified in input field Find: ___) are equivalent:

    'his cat' his cat x'8889A2408381A3' X'8889A2408381A3' 8889A2408381A3
    ' his cat' his cat x'408889A2408381A3' X'408889A2408381A3' 408889A2408381A3