Recently I was asked to write a utility that would do the opposite of our SDUnix utility.
SDUNIX takes an MPE file and makes it into an HP-UX self-describing file by splitting out the MPE userlabels information into a separate file, which Suprtool for HP-UX can use. SDMPE will do the opposite of Sdunix and take the "label" file and the data file and combine into a new data file.
run sdmpe.pub.robelle SDMPE/iX/Copyright Robelle Solutions Technology Inc. 2006 (Version 0.1) This program must have three file names passed in thru the info string. The first file name being the data file, the second file name being the label file and the third file specified being the new data file that will be created. The new file must not already exist. run sdmpe;info='datafile labelfile newfile'.>form x
File: x (SD Version B.00.00) No linefeeds
Entry: | Offset | ||
DIST | I1 | 1 | |
INV_NBR | I2 | 3 | |
PROC_DATE | X10 | 7 | |
PROD_NBR | I2 | 17 | |
CM_NBR | I2 | 21 | |
ACCTNG_YR | I1 | 25 | |
ACCTNG_QTR | I1 | 27 | |
ACCTNG_MO | I1 | 29 | |
ACCTNG_WK | I1 | 31||
CUST_NBR | I2 | 33 | |
TRAN_TYPE | X2 | 37 | |
CD_RSN_CD | I1 | 39 | |
DIST_SLS_MGR_ID | X8 | 41 | |
SLS_REP_USER_ID | X8 | 49 | |
SLS_RTE | I1 | 57 | |
VNDR_NBR | I2 | 59 | |
EACH_CONV_FCTR | I1 | 63 | |
EACH_ORGNL_ORD | I1 | 65 | |
EACH_ORDD | I1 | 67 | |
EACH_SHPD | I1 | 69 | |
UNIT_ORGNL_ORD | I2 | 71 | |
UNIT_ORDD | I2 | 75 | |
UNIT_SHPD | I2 | 79 | |
EACH_PRICE | I4 | 83 | << .4 >> |
UNIT_PRICE | I4 | 91 | << .4 >> |
EXTND_FCTR | I4 | 99 | << .4 >> |
GROSS_SLS_EXTND | I4 | 107 | << .2 >> |
NET_SLS_EXTND | I4 | 115 | << .2 >> |
ACTL_EXTND | I4 | 123 | << .2 >> |
INVY_COST_EXTND | I4 | 131 | << .2 >> |
FRGT_COST | I4 | 139 | << .2 >> |
PROD_SLS_TAX | I4 | 147 | << .2 >> |
GROSS_WGHT_SHPD | I4 | 155 | << .2 >> |
NET_WGHT_SHPD | I4 | 163 | << .2 >> |
SUB_FOR | I2 | 171 | |
SUB_CONV_FCTR | I4 | 175 | << .3 >> |
BRK_SUR_CHRG | I4 | 183 | << .2 >> |
DLVY_RTE | I1 | 191 | |
REP_COST_EXTND | I4 | 193 | << .2 >> |
DEV_COST_EXTND | I4 | 201 | << .2 >> |
LIC_COST_EXTND | I4 | 209 | << .2 >> |
CM_DOLRS | I4 | 217 | << .2 >> |
CM_INVY_CST_EXTD | I4 | 225 | << .2 >> |
PROD_ALWNC | I4 | 233 | << .2 >> |
PROD_CHRG | I4 | 241 | << .2 >> |
LPA | I4 | 249 | << .2 >> |
NPA | I4 | 257 | << .2 >> |
CUST_ADJ | I4 | 265 | << .2 >> |
>ll x.sd -rw-rw-rw- 1 neil other 1696 Nov 2 2005 x.sd
In order to ftp a .sd file and data file from HP-UX to MPE you will need two pieces of information. The entry length for the data in the data file, which can be found at the end of the form listing, this will be used as the rec= parm on the ftp get from the MPE box.
The second piece of information is the total bytes of the ".sd" file so that we can retrieve as a single record.
So given that our test files on HP-UX are x and x.sd respectively we would get the files in the following manner.
/ftp mydev.server.com File Transfer Protocol [A0011001] (C) Hewlett-Packard Co. 1990 220 mydev.server.com FTP server (Revision 1.006 Version wuftpd-2.6.1 Mon Oct 17 14:45:24 GMT 2005) ready. Name(bob): neil 331 Password required for neil. Password: 230 User neil logged in. Remote system type is UNIX ftp> cd /users/mydev/data ftp> binary ftp> get x myx;rec=-272,1,f,binary;disc=30000 ftp> get x.sd myx.sd;rec=-1696,1,f,binary;disc=2
You will notice that for the MPE name of the file I specified a group name on the MPE side as well. I just added the group sd to my directory so that I don't have to think up new names for data files that are greater than six characters. Now I just have to specify the data file name and the "sd" file name just like it was on HP-UX. It simply just makes things easier to remember.
/run sdmpe.pubnew.robhome;info='myx myx.sd mynewx' SDMPE/iX/Copyright Robelle Solutions Technology Inc. 2006 (Version 0.1) CPU-Sec=1. Wall-Sec=1. End Run /listf mynewx,2 ACCOUNT= GREEN GROUP= NEIL FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE---- SIZE TYP EOF LIMIT R/B SECTORS #X MX MYNEWX SD 272B FA 21428 30000 1 23840 26 *
You can see below the new file specified SD information from within Qedit. (Did you know that Qedit could do a form command on an SD file now?)
/form mynewx
Self-describing information for MYNEWX.NEIL.GREEN
File: MYNEWX.NEIL.GREEN (SD Version B.00.00)
Entry: | Offset | ||
DIST | I1 | 1 | |
INV_NBR | I2 | 3 | |
PROC_DATE | X10 | 7 | |
PROD_NBR | I2 | 17 | |
CM_NBR | I2 | 21 | |
ACCTNG_YR | I1 | 25 | |
ACCTNG_QTR | I1 | 27 | |
ACCTNG_MO | I1 | 29 | |
ACCTNG_WK | I1 | 31||
CUST_NBR | I2 | 33 | |
TRAN_TYPE | X2 | 37 | |
CD_RSN_CD | I1 | 39 | |
DIST_SLS_MGR_ID | X8 | 41 | |
SLS_REP_USER_ID | X8 | 49 | |
SLS_RTE | I1 | 57 | |
VNDR_NBR | I2 | 59 | |
EACH_CONV_FCTR | I1 | 63 | |
EACH_ORGNL_ORD | I1 | 65 | |
EACH_ORDD | I1 | 67 | |
EACH_SHPD | I1 | 69 | |
UNIT_ORGNL_ORD | I2 | 71 | |
UNIT_ORDD | I2 | 75 | |
UNIT_SHPD | I2 | 79 | |
EACH_PRICE | I4 | 83 | << .4 >> |
UNIT_PRICE | I4 | 91 | << .4 >> |
EXTND_FCTR | I4 | 99 | << .4 >> |
GROSS_SLS_EXTND | I4 | 107 | << .2 >> |
NET_SLS_EXTND | I4 | 115 | << .2 >> |
ACTL_EXTND | I4 | 123 | << .2 >> |
INVY_COST_EXTND | I4 | 131 | << .2 >> |
FRGT_COST | I4 | 139 | << .2 >> |
PROD_SLS_TAX | I4 | 147 | << .2 >> |
GROSS_WGHT_SHPD | I4 | 155 | << .2 >> |
NET_WGHT_SHPD | I4 | 163 | << .2 >> |
SUB_FOR | I2 | 171 | |
SUB_CONV_FCTR | I4 | 175 | << .3 >> |
BRK_SUR_CHRG | I4 | 183 | << .2 >> |
DLVY_RTE | I1 | 191 | |
REP_COST_EXTND | I4 | 193 | << .2 >> |
DEV_COST_EXTND | I4 | 201 | << .2 >> |
LIC_COST_EXTND | I4 | 209 | << .2 >> |
CM_DOLRS | I4 | 217 | << .2 >> |
CM_INVY_CST_EXTD | I4 | 225 | << .2 >> |
PROD_ALWNC | I4 | 233 | << .2 >> |
PROD_CHRG | I4 | 241 | << .2 >> |
LPA | I4 | 249 | << .2 >> |
NPA | I4 | 257 | << .2 >> |
CUST_ADJ | I4 | 265 | << .2 >> |