Hierarchical file system API support for DDM

 

The hierarchical file system (HFS) APIs and the functions that they support are part of the i5/OS® operating system.

The APIs provide applications with a single, consistent interface to all the hierarchical file systems available on your iSeries™ server. They automatically support the document library services (DLS) file system and can support user-written file systems also.

DDM can be registered under HFS as one of the user-written file systems. DDM, however, only supports the copy stream file (QHFCPYSF) HFS API. To register DDM under HFS, run the following command on your iSeries source system, CALL QTSREGFS. If no errors occur, DDM is successfully registered with HFS.

Calling DDM using the HFS QHFCPYSF API causes one of two DDM-architected commands to be generated, the LODSTRF (load stream file) or ULDSTRF (unload stream file) command. Both of these DDM commands are part of the stream file DDM model (STRFIL). If the DDM target server you are working with does not support the STRFIL DDM model, then errors will occur when trying to use this support. DDM uses documents and folders (DLS) on the server to copy stream file data either to (ULDSTRF case) or from (LODSTRF case).

To use the DDM HFS copy stream file support, note the following items:

Here is a copy stream file example that will generate a LODSTRF DDM command to a remote server:

CRTDDMF FILE(DDMLIB/DDMFILE) +
RMTFILE(*NONSTD 'TARGET/SYSTEM/
SYNTAX/PATHNAME FMS') RMTLOCNAME(RMTSYSNM)

In this example, the local DLS object is 'PATH1/PATH2/FOLDER1/DOC1'.

You would call QHFCPYSF with the following parameter list:

1   Source file path name = '/QDDM/PATH1/PATH2/FOLDER1/DOC1 FMS'
2   Source file path name length = 34
3   Copy information = valid HFS value that is ignored by DDM 4   Target file path name = '/QDDM/DDMLIB/DDMFILE'
5   Target file path name length = 20

Just reverse the source and destination file path names and lengths to generate an ULDSTRF DDM command.

The example program in the following example calls DDM HFS API:

By using the code examples, you agree to the terms of the Code license and disclaimer information. Figure 1. Program example

/********************************************************************/
/********************************************************************/
/*  FUNCTION: This program copies a stream file using the QHFCPYSF  */
/*            HFS API.                                              */
/*                                                                  */
/*  LANGUAGE: PL/I                                                  */
/*                                                                  */
/*  APIs USED: QHFCPYSF                                             */
/*                                                                  */
/********************************************************************/
/********************************************************************/
TRANSFER: PROCEDURE(SRCFIL,TRGFIL) OPTIONS(MAIN);
 
/* parameter declarations                                           */
DCL SRCFIL CHARACTER (73);
DCL TRGFIL CHARACTER (73);
 
/* API entry declarations                                           */
/*                                                                  */
/* The last parameter, the error code, is declared as FIXED BIN(31) */
/* for the API. This always has a value of zero, specifying that    */
/* exceptions should be returned.                                   */
DCL QHFCPYSF ENTRY(CHAR(73),FIXED BIN(31),CHAR(6),CHAR(73),
                   FIXED BIN(31),FIXED BIN(31))
                   OPTIONS(ASSEMBLER);
 
/********************************************************************/
/*  Parameters for QHFCPYSF                                         */
/********************************************************************/
DCL srclen FIXED BIN(31);
DCL trglen FIXED BIN(31);
DCL cpyinfo CHAR(6);
DCL error_code FIXED BIN(31);
 
/********************************************************************/
/*  Mainline routine                                                */
/********************************************************************/
 
srclen = INDEX(SRCFIL,'  ') - 1;
trglen = INDEX(TRGFIL,'  ') - 1;
cpyinfo = '1     ';
error_code = 0;
/* Copy the stream file                                             */
Call QHFCPYSF(SRCFIL,srclen,cpyinfo,TRGFIL,trglen,
              error_code);
 
END TRANSFER;

Sample command source that can be used with the preceding program:

CMD      PARM    KWD(SRCFIL) TYPE(*CHAR) LEN(73) +
               PROMPT('SOURCE FILE NAME')
     PARM    KWD(TRGFIL) TYPE(*CHAR) LEN(73) +
               PROMPT('TARGET FILE NAME')

 

Parent topic:

Use language, utility, and application support for DDM

 

Related concepts


Application programming interfaces

 

Related reference


Hierarchical File System APIs
LODSTRF (Load Stream File) Level 2.0
ULDSTRF (Unload Stream File) Level 2.0