Skip to main content

Posts

Showing posts from 2016

Working with IFS in RPGLE

Read IFS file in RPGLE Working with IFS file has always been one of the important things while programming with RPGLE. The most common way to deal with IFS file is  Copy the IFS file to Flat file using CPYFRMIMPF/CPYFRMSTMF. Read the Flat file in RPGLE. Or  Write the Data into File in RPGLE. Copy the File to IFS by using CPYTOIMPF/CPYTOSTMF. This involves writing additional CL Program or using QCMDEXC API to execute CL Command to copy the data from/to IFS and Creation of Temporary/Permanent Database file.  Accessing IFS files has become easy by using 'open', 'close', 'read' and 'write' functions. Below is an Simple Example on how to Read data from IFS and write into Database file. **Free      Ctl-Opt DftActGrp(*No) ;      // ProtoType Declaration for 'open'      Dcl-PR OpenIfs Int(10) ExtProc('open') ;        pIfsPath Pointer Value Options(*String) ;        pFileStatusFlag Int(10) Value ;        pFilePermission Uns(10) Value Options(*NoPa

Advantages of using Free-format RPGLE

Advantages of Using Free-Format RPGLE IBM has always been focusing on making the RPG easy for Non-RPG Programmers. One such Important move is introducing the Free-Format into RPG for C-Spec.  Introducing Eclipse based RDi is another biggest move. This encourages young developers in learning RPG like any other web based languages. RDi has an addition to convert your Fixed Format code to Free-Format.  Almost after a Decade of Introducing Free-Format, IBM took major Step to Convert RPG into Full-Free format. As a Core RPG Developer, I can say this as 'Really Huge' change to the way how RPG was being coded and how the RPG has become now. This has changed its way from RPG II, RPG III and to Full-Free Format. We will have a quick look at the Major advantages of Using Free-Format RPGLE in this article. Readability Efficient use of Space New Features Specific to Free Format Easy to Understand/Maintain Readability: No need to stick to specific columns and thinking about the limitations

Working with 5250 Emulator from IBM Navigator for i

The W eb based Navigator for i is a new interface for IBM i. This will change the way you look at IBM i completely. This advanced Set Target System feature lets you manage any IBM i in your environment from a single browser. But its real power is allowing you to use the newest version of the web console against systems at older releases, including IBM i 6.1 and IBM i 5.4. The web based console now includes a 5250 Emulator for those times when you just need a good old fashioned command-line interface. The integrated DB2 Database has enhancements on both the web-based and Windows based consoles to improve performance analysis and provide more gradual user access. Speaking of performance, the Performance Data Investigator continues enhancing its visual yet power fun analysis and reporting interface. Journal now provides a full set of options to display and control journal objects. I felt very excited to see this change happening in IBM i and looking forward for more such enhancements whi

Working with XML in RPGLE : XML-SAX

Working with XML in RPGLE : XML-SAX Working with XML has never been easier before IBM's introduction of XML-INTO and XML-SAX compatibility to RPGLE. My earlier post did contain detailed info about basics on XML with RPGLE and compatibility of XML-INTO with RPGLE along with its own advantages and disadvantages. If you haven't gone through them yet, Click on those links to have quick look. XML-SAX: Even though XML-INTO provides the greatest comfort to programmers by directly bringing the data to Respective variable/data structure. But, this doesn't help programmers when the XML elements/data has been inconsistent. XML-SAX is the best way of handling such XMLs. This will read the XML character by character and calls Handling Procedure when the even gets triggered. Syntax: Xml-Sax(e) %Handler(XMLHandler_Procedure : CommsArea_DataStructure ) %XML(wXmlString: 'doc=string') Below are some possible events that can occur while parsing XML.  This has been split by the phas

Working with XML in RPGLE - Contd.

Working with XML in RPGLE We have seen how to read XML in RPG by using XML-INTO in the previous post. If you have not gone through this yet,  Click Here to have quick look. Before we get started with XML-SAX here are some other key points to be noted about XML. Key Points to Remember: The XML documents can be in a character or UCS-2 RPG variable, or they can be in an Integrated File System file. This would give freedom to the programmer to choose the best suited form.  The parser is a SAX (Simple API for XML) parser. A SAX parser operates by reading the XML document character by character. Whenever it has located a fragment of the XML document, such as an element name, or an attribute value, it calls back to a handling procedure provided by the caller of the parser, passing it information about the fragment of XML that it has found. It'd be easier to understand with an example. E.g.: When the parser has found an XML element name, it calls the handling procedure indicating that th

Working with XML in RPGLE : XML-INTO

Working with XML in RPGLE XML has been one of the best format to pass a communication message between different Applications/Servers. This can be easily readable by both Humans & Machines. With the introduction of XML-INTO Opcode in RPGLE, Reading XML has become easier in RPG. XML-INTO: XML-INTO is an Opcode introduced for RPG programmers to retrieve XML data directly to RPG Variable. This Opcode need to be used in conjuction with %XML & %HANDLER. This can be used in both Free & Fixed Formats. Yet, There will be limitations for using in fixed format. One of the Main Reasons being the its limitation on Number of digits. XML-INTO parses an XML document extracting a single element directly into a variable (Or an array). Usually, This will be used to extract multiple elements and values will be populated to Data Structure. But, This approach would be better suited if number of items retrieved is known. The basic syntax of the basic variant of XML-INTO is: XML-INTO { (E H} } va