Friday, May 29, 2009

(Q&A) Can i connect visual basic to AS400?

From: Bryan Arancon

Please find steps below on how you can create AS400 connection using visual basic.

Step 1:
'Define the ODBC Connection string
Dim MyODBCConnection As New OdbcConnection("Driver={Client Access ODBC Driver (32-bit)};" & _
"System=AS400Name;" & _
"TRANSLATE=1;" & _
"Uid=UserID;" & _
"Pwd=User Password")
'Open the connection
MyODBCConnection.Open()

Step2:
'Define the SQL statement to extract the data from the AS400
Dim selectCMD As OdbcCommand = New OdbcCommand("SELECT * FROM LIBRARY.FILE WHERE FILEFIELD='YourChoice' order by FILEFIELD", MyODBCConnection)

Step3:
'Initialize the reader
Dim dr As OdbcDataReader = selectCMD.ExecuteReader

Step4:
Try
'Set the mouse to show a Wait cursor
Me.Cursor = Cursors.WaitCursor
'start the Read loop
While dr.Read
'Note: the numbers in double quotes represent the column number from the AS400 database
'Add the data to the list view
Dim listItem As New ListViewItem(dr.GetString("2"))
listItem.SubItems.Add(dr.GetString("3"))
ListView1.Items.Add(listItem)
'End the loop
End While
'Reset the cursor
Me.Cursor = Cursors.Default

Catch ex As Exception
End Try

Step 5:
'Close the connection
MyODBCConnection.Close()
MyODBCConnection.Dispose()



Read More...

(Q&A) Problem Regarding CSV Files

From: Kropeck

Question:
Hi As400 Guru,
I have a problem regarding on CSV files.
I have made a program that will produce records in CSV format.
But when i downloaded it and opened it in Excel. The card numbers are different.
Instead of 1234567891234567, the number in excel would come out like 4.321+13 sumthin like that. But when i check it in RPG card number is OK and also when CSV is opened using notepad.
Thank you!!

Answer:
I think that this is Excel's limitation to handle large number (numbers with length greater than 15), it is being automatically converted to exponential notation value. This happens when you double click the CSV file then Excel will open the file. You can avoid this by changing your file extension, instead of CSV you may use other extensions, for example you can use XXX as your file extension. this way when you open it with excel it will ask you on how to open the file, if it's delimited and it will also ask you the column format, whether you like it as character, numeric or general format.
Hope this helps. Thanks.
Read More...

(FAQ) What Does RPG Stands For?

RPG is a programming language for business applications. Originally an initialism for Report Program Generator (RPG). Note that while the primary vendor of RPG has been and remains IBM, the language was available from other mainframe and microcomputer manufacturers, including Unisys. The latest incarnation of RPG is RPG IV (aka ILE RPG) on IBM's System i servers; it inherits the System i Integrated Language Environment’s features such as prototyped functions and procedures, static and dynamic binding, access to C routine libraries, dynamic link libraries, and fully recursive and re-entrant modular code.

Read More...

Thursday, May 28, 2009

(Q&A) What Does VNC Stands For?

(from: Kropeck)

What does VNC stands for?
Ex. VNC to 198.xxx.xxx.xx
Could you please help me on this one?

Virtual Network Computing (VNC) is a graphical desktop sharing system that uses the RFB protocol to remotely control another computer. It transmits the keyboard and mouse events from one computer to another, relaying the graphical screen updates back in the other direction, over a network.

VNC is platform-independent – a VNC viewer on one operating system may connect to a VNC server on the same or any other operating system. There are clients and servers for many GUI-based operating systems and for Java. Multiple clients may connect to a VNC server at the same time. Popular uses for this technology include remote technical support and accessing files on one's work computer from one's home computer, or vice versa.

IBM has a VNC for the iSeries that you can install if you have PASE. You can download VNC for the iSeries free from IBM's iSeries Tools for Developers Web page. Although VNC is free for the iSeries, it requires the Portable Application Solutions Environment (PASE) and Perl, which is part of the iSeries Tools for Developers PRPQ. See the article, "Native Graphics, VNC, and Perl," Midrange Guru, OS/400 Edition, at for more information about PASE, Perl, and the iSeries Tools for Developers.
Read More...

(Q&A) How Can I Check the Status of Job Switch in RPG?

(From: Kammy)

In CL you can do this by using RTVJOBA command, the SWS parameter will return the switch values.

In RPG you can use Retrieve Job Description Information (QWDRJOBD) API having the following parameters:

1 Receiver variable Output Char(*)
2 Length of receiver variable Input Binary(4)
3 Format name Input Char(8)
4 Qualified job description name Input Char(20)
5 Error code

To learn more about this API you can check it here.
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/apis/qwdrjobd.htm
Read More...

Wednesday, May 27, 2009

(Q&A) What's the difference between *DATE and *UDATE in RPG?

(From: 宁静的琴声)

UDATE supports 2 digit year, with format *MDY (MMDDYY).

*DATE supports 4 digit year, with format *MDYY (MMDDYYYY).

Both dates are based on the job run date.
Read More...

(Announcement) Place Your Questions Here



For questions, just enter your questions (here) as comment.
Then I will create a new topic based on your query.

Thanks.


Read More...

(Announcement) Welcome!



Welcome to as400questions.blogspot.com!

I created this blog to help new AS400 programmers to find answers to their questions.

So, if you're having a hard time thinking of a solution this is the place to ask.

- OSS4


http://www.condron.us
Advertise your blog for free!
Read More...