Load combo box from XML C# .net
This is an XML of the format I am using. Note Text and Value fields for the combo box.
<?xml version="1.0" encoding="UTF-8"?> <Items> <Item> <Text>Line 5</Text> <Value>L:\plating\line5\</Value> </Item> <Item> <Text>Line 6</Text> <Value>L:\plating\line6\</Value> </Item> <Item> <Text>Line 7</Text> <Value>L:\plating\line7\</Value> </Item> <Item> <Text>Line 8</Text> <Value>L:\plating\line8\</Value> </Item> </Items>
The following is the c# code.
DataSet ds = new DataSet(); ds.ReadXml("Lines.xml"); comboBox1.DataSource = ds; comboBox1.DisplayMember = "Item.Text"; comboBox1.ValueMember = "Item.Value";
Enabling Netuser Id on Iseries
Sometimes Netuser id’s get disabled. The link is a way to enable the netuser id from Green Screen.
Recursive SQL statement to read MAPICS Bill of materials
Recursive SQL Statement to read bill of materials, the DEPTH FIRST statement will keep it in sequence. Otherwise it will be by Level.
WITH temp_pstruc (RELVL, ITEM, QTY) AS
(
SELECT 0, PINBR, 0
FROM AMFLIB.PSTRUC where pinbr = ‘*PUT YOUR PART HERE*’
UNION ALL SELECT a.relvl + 1, b.cinbr, b.qtypr
FROM temp_pstruc AS a join amflib.pstruc AS b
on ITEM = b.pinbr
)
SEARCH DEPTH FIRST BY item SET ORDCOL
SELECT *
FROM temp_pstruc
ORDER BY ORDCOL
Create a table of table names and fields (DB2)
DROP TABLE LIB.FIELDS; |
DROP TABLE LIB.TABLES; |
CREATE TABLE LIB.FIELDS AS ( |
SELECT DBNAME, SYS_TNAME, SYS_CNAME, NAME, TBNAME, COLNO, |
COLTYPE, LENGTH, SCALE, LABELTEXT, PRECISION |
FROM QSYS2.SYSCOLUMNS WHERE DBNAME = ‘LIBRARY’ ) |
WITH DATA; |
CREATE TABLE LIB.TABLES AS ( |
SELECT * FROM QSYS2.SYSTABLES WHERE DBNAME = ‘LIBRARY’) |
WITH DATA; |
Sorting Iseries (as400) client access transfers by arrival sequence
The IBM doc
http://www-01.ibm.com/support/docview.wss?uid=nas8N1015935
suggest the following to sort a data transfer by arrival sequence or relative record number. Sometimes the transfer will get confused and randomly pull another access path, which can cause unexpected results.
RRN(xxxxxx)
Just replace xxxxxx with the file(table) name.
Transfering a user signon to QCTL
This CL can be used on Iseries for a signon job to transfer to qctl. You must change signon program on user profile.
refer to http://www-01.ibm.com/support/docview.wss?uid=nas8N1010199
0001.00 PGM
0002.00 DCL VAR(&TFR) TYPE(*CHAR) LEN(1)
0003.00 CRTDTAARA DTAARA(QTEMP/LOGON) TYPE(*CHAR) LEN(1)
0004.00 MONMSG MSGID(CPF1023)
0005.00 RTVDTAARA DTAARA(QTEMP/LOGON) RTNVAR(&TFR)
0006.00 IF COND(&TFR = ‘ ‘) THEN(DO) /* There is a blank space between the single quotes */
0007.00 CHGDTAARA DTAARA(QTEMP/LOGON) VALUE(‘N’)
0008.00 TFRJOB JOBQ(QCTL) /* TO TRANSFER TO SUBSYSTEM QCTL*/
0009.00 ENDDO
0010.00 ENDPGM
Automatic Iseries Navigator connections
The cwblogon program in client access will open a connection to an Iseries/as400. This allows the connection properties is to “prompt as needed”, no other password will need to be entered.
CWBLOGON system /u userid /p password
system i db2 functions for getting current date and weekday
Get Current Date
SELECT current date FROM sysibm.sysdummy1;
Get Current Day Name
SELECT DAYNAME(date(current_date)) FROM sysibm.sysdummy1;
Get Current Day of Week
SELECT DAYOFWEEK(date(current_date)) FROM sysibm.sysdummy1;
http://www.ibm.com/developerworks/data/library/techarticle/0211yip/0211yip3.html
Create a table based on summary data DB2 i5/OS
Syntax for creating a table based on query results from another table.
CREATE TABLE LIBRARY/SUMMARY AS
( SELECT CLASS, ITEM, SUM(NET) AS NET_SALES
FROM LIBRARY/DETAIL GROUP BY CLASS, ITEM ) WITH DATA
Backup files from a batch file and add a timestamp
FOR %%V IN (FILENAME.XXX) DO FOR /F “tokens=1-6 delims=/: ” %%J IN (“%%~tV”) DO IF EXIST backups\%%L%%J%%K_%%M%%N%%O%%~xV (ECHO Cannot copy %%V) ELSE (COPY “%%V” backups\FILENAME_%%L%%J%%K_%%M%%N%%O%%~xV)