3 # Installation of the ILE/RPG header files in the OS/400 library.
5 # See Copyright for the status of this software.
7 # Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
10 SCRIPTDIR=`dirname "${0}"`
11 . "${SCRIPTDIR}/initscript.sh"
12 cd "${TOPDIR}/os400/libxmlrpg"
15 # Create the OS/400 source program file for the ILE/RPG header files.
17 SRCPF="${LIBIFSNAME}/LIBXMLRPG.FILE"
19 if action_needed "${SRCPF}"
20 then CMD="CRTSRCPF FILE(${TARGETLIB}/LIBXMLRPG) RCDLEN(112)"
21 CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libxml2: ILE/RPG header files')"
26 # Map file names to DB2 name syntax.
30 for HFILE in *.rpgle *.rpgle.in
31 do NAME="`basename \"${HFILE}\" .in`"
32 VAR="`basename \"${NAME}\" .rpgle`"
33 VAL="`db2_name \"${NAME}\" nomangle`"
35 if [ "${VAR}" = 'xmlschemastypes' ]
39 echo "s/${VAR}/${VAL}/g" >> tmpsubstfile
40 eval "VAR_${VAR}=\"${VAL}\""
47 sed -e '\#^....../include *"libxmlrpg/#{' \
51 -e 's#.*# /include libxmlrpg,&#' \
56 # Create the IFS directory for the ILE/RPG header files.
58 RPGIFSDIR="${IFSDIR}/include/libxmlrpg"
60 if action_needed "${RPGIFSDIR}"
61 then mkdir -p "${RPGIFSDIR}"
64 # Copy the header files to IFS ILE/RPG include directory.
65 # Copy them with include path editing to the DB2 library.
67 for HFILE in *.rpgle *.rpgle.in
68 do IFSCMD="cat \"${HFILE}\""
69 DB2CMD="change_include < \"${HFILE}\""
70 IFSFILE="`basename \"${HFILE}\" .in`"
74 *.in) IFSCMD="${IFSCMD} | versioned_copy"
75 DB2CMD="${DB2CMD} | versioned_copy"
79 IFSDEST="${RPGIFSDIR}/${IFSFILE}"
81 if action_needed "${IFSDEST}" "${HFILE}"
82 then eval "${IFSCMD}" > "${IFSDEST}"
85 eval DB2MBR="\"\${VAR_`basename \"${IFSDEST}\" .rpgle`}\""
86 DB2DEST="${SRCPF}/${DB2MBR}.MBR"
88 if action_needed "${DB2DEST}" "${HFILE}"
89 then eval "${DB2CMD}" | change_include > tmphdrfile
91 # Need to translate to target CCSID.
93 CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DB2DEST}')"
94 CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"