RPGIV @ Work

A unique site for RPG and System i Lovers

Welcome!

Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

Blog - Content Section Layout
Error Handling Example
User Rating: / 1
Written by Chamara Withanachchi   
     FCustomer  UF A E           K Disk

     D CustomerData  E DS                  ExtName(Customer:CustRec)
     D CustData        S                   Like(CustomerData)
     D Valid           S               N
     D Total           S              5S 0 Inz(0)
     D StatusCode      S              5S 0 Inz(0)
     D RecordLock      C                   Const(01218)
     D Result2Big      C                   Const(00103)

     C     *Entry        Plist
     C                   Parm                    CustData

      /free

           Monitor;

           CustomerID = %SubSt(CustomerData:1:8);

           DoU %Status <> RecordLock;
              Chain CustomerID Customer;
           EndDo;
              
              If %Found;
                 ExSr Validate;
                 If Valid;
                    Total = Total + 1;  // Accumulate number of udates
                    Update Custrec;     // update record format
                 EndIf;
              Else;
                 ExSr Validate;
                 If Valid;
                 Write Custrec;         // write to record format
                 EndIf;
              Endif;

       // Begin error trapping for any error with Monitor group

              On-Error RecordLock;        // Record Lock
                 Dsply 'Record Locked - Sorry Charlie';

              On-Error *FILE;             // Any other file error
                 StatusCode = %Status;
                 Dsply StatusCode;
                 Dsply 'Some File Error';

              On-Error Result2Big;        // Field not large enough
                 Dsply 'Define the result big enough, goofy';

              On-Error *PROGRAM;          // Any other program error
                 StatusCode = %Status;
                 Dsply StatusCode;
                 Dsply 'Some Program Error';

              On-Error *ALL;              // Any error not already trapped
                 Dsply 'Already trapping *FILE and *PROGRAM - do not need';

           EndMon;

           *InLr = *On;

        // ****************************************************************
        // Validate subroutine - validate data before updating
        // ****************************************************************

           BegSr Validate;

              CustomerData = CustData;
              Valid = *on;   // Some validation, eh?

           EndSr;

      /end-free

Write Comment (0 comments)
Control Language Copybooks
User Rating: / 2
Written by Chamara Withanachchi   

In i/OS 6.1 is the Control Language command INCLUDE. The command finally allows us to have CL "CopyBooks" for OPM and ILE Control Language programs. INCLUDE is the basic equivalent of the RPG and COBOL statement /COPY.


The INCLUDE command is used within a CLP or CLLE source member to indicate the source code member that will be copied (i.e. INCLUDED). The format of the command is:


  INCLUDE SRCMBR(MYCOPY1) SRCFILE(*INCFILE)

The SRCMBR parameter identifies the name of the source member that will be included(copied) into this location during the compile operation.


The SRCFILE parameter allows you to specify that the Included member resides in the *DEFAULT source file(*INCFILE). You can also specify a different source file as the repository of the Included source members, as in the following example.


  INCLUDE SRCMBR(MYCOPY1) SRCFILE(MYLIB/INCLUDES)
Write Comment (0 comments)
CVTDAT
User Rating: / 0
Written by Chamara Withanachchi   

You can use CVTDAT command in a CL for two tasks, The Convert Date (CVTDAT) command in CL is designed to convert a date from one format to another. And, it also checks the data (before conversion) to make sure it's valid.


Sample Program


   PGM                                                      
                                                            
   DCL        VAR(&CDATE) TYPE(*CHAR) LEN(6)                
   DCL        VAR(&RDATE) TYPE(*CHAR) LEN(7)                
   DCL        VAR(&USER) TYPE(*CHAR)  LEN(10)               
                                                            
   DCL        VAR(&DAY) TYPE(*DEC) LEN(3)                   
   DCL        VAR(&YEAR) TYPE(*DEC) LEN(4)                  
   DCL        VAR(&EXPDT) TYPE(*CHAR) LEN(6)                
                                                            
   /* Get the current User and Current Date */              
   RTVJOBA    USER(&USER) DATE(&CDATE)                      
   CVTDAT     DATE(&CDATE) TOVAR(&RDATE) FROMFMT(*JOB) +    
                TOFMT(*LONGJUL) TOSEP(*NONE)                
                                                            
   CHGVAR     VAR(&DAY) VALUE(%SST(&RDATE 5 3))             
   CHGVAR     VAR(&DAY) VALUE(&DAY + 30)                    
   CHGVAR     VAR(%SST(&RDATE 5 3)) VALUE(&DAY)             
   CVTDAT     DATE(&RDATE) TOVAR(&EXPDT) FROMFMT(*LONGJUL) +
                TOFMT(*JOB) TOSEP(*NONE)                    

   MONMSG     MSGID(CPF0555) EXEC(DO)                        
   CHGVAR     VAR(&YEAR) VALUE(%SST(&RDATE 1 4))             
   CHGVAR     VAR(&YEAR) VALUE(&YEAR + 1)                    
   CHGVAR     VAR(%SST(&RDATE 1 4)) VALUE(&YEAR)             
   CHGVAR     VAR(%SST(&RDATE 5 3)) VALUE('030')             
   CVTDAT     DATE(&RDATE) TOVAR(&EXPDT) FROMFMT(*LONGJUL) + 
                TOFMT(*JOB) TOSEP(*NONE)                     
   ENDDO                                                     
Write Comment (0 comments)
Extract part of date or time with %subdt
User Rating: / 1
Written by Chamara Withanachchi   

Define date field:



   D  ISOdate      S              D   datfmt(*ISO) inz(*SYS) 

If not initializing ISOdate to current system date (*SYS) in the D spec it is easy to get the system date:


     eval ISOdate  = %date()

Then select what part of the date you need with %subdt:


  
     eval curYear  = %subdt(ISOdate: *YEARS)
     eval curMonth = %subdt(ISOdate: *MONTHS)

How to retrieve the date one month prior to today:

eval ISOdate = %date() eval ISOdate = %date() - %months(1)


How to extract current minutes from time or timestamp as a character value:


/free curMinute = %char(%subdt(%time():*MN)); /end-free

Valid parameters:


*Days, *D, *Months, *M, *Years, *Y, *Seconds, *S, *Minutes, *MN, *Hours, *H (and *MSeconds, *MS for timestamps).
SEQUEL
User Rating: / 0
Written by Chamara Withanachchi   

What is SEQUEL?

SEQUEL is a simple, powerful data access, analysis, and presentation tool for IBM Power Systems running IBM i.


From simple ad hoc queries to executive dashboards to providing information on the Web, SEQUEL delivers System i data in the format that works best for you. Without exception, SEQUEL is the fastest and easiest way to access your System i data.


For the Video click Here

Query and Reporting

SEQUEL views and reports complete in a fraction of the time of other query tools available on the System i.

  • SEQUEL ViewPoint provides a Windows-based, graphical interface that helps any user design views quickly.
  • SEQUEL Tabling automatically summarizes data by categories, similar to a pivot table, to complete in seconds what could require multiple queries or programs.
  • The ViewPoint Report Writer helps you design reports quickly, using Wizards and drag-and-drop functions, on a graphical report design layout.
  • The Client Reporting Option lets you design reports containing formatted text and graphics for PC printer output.

End User Access

SEQUEL users can access data, quickly and easily.

  • Shortcuts display, e-mail, graph, or download the latest information.
  • Run-time prompting lets users run a standard view using different selection parameters.
  • SEQUEL ViewPoint's graphical, drag-and-drop design interface makes ad hoc requests a snap.
  • Predefine JOIN criteria, calculations, date field conversion, and meaningful field names so anyone can create views.

Data Distribution on the Web, Network, or by E-mail

Run secure interactive requests on the Web (or display spooled files) with the SEQUEL Web Interface. The power of i5/OS security restricts general access, while SEQUEL record-level security restricts specific subsets of data to certain users.

  • Distribute output in different formats to servers or e-mail recipients. SEQUEL converts System i data into HTML, PDF, Excel, and other PC formats, or spooled files.
  • Send broadcast e-mails, such as invoices, statements or marketing announcements, with unique messages for each recipient.

Business Analytics

Summarize, "cleanse", and reformat data for OnLine Analytical Processing (OLAP) "cubes" without extensive programming. Use dynamic drill-down to explore data from a high-level summary to detailed information.

Programmer Productivity

SEQUEL’s extensive character and numeric operations let you transform DB2 data to almost any conceivable format. Its UPDATE, DELETE, INSERT, and EXECUTE functions let you "cleanse" and reformat DB2 data without having to write a program.

User Access

SEQUEL is designed for all levels of users—executives and other non-technical users just click a desktop icon to display, e-mail, or download SEQUEL results from the System i. For complete flexibility, SEQUEL offers a number of ways to access information.

View Design

A SEQUEL query is referred to as a view and it contains all of the selection criteria you need to access your System i data. SEQUEL makes it easy to design views using simple point-and-click operations. You can create ad hoc queries any time you need information from your System i database.

Tabling

SEQUEL provides two table options—Host Tables and Client Tables—that you can use to summarize transaction data into spreadsheet-like tables. With SEQUEL’s tabling options, you can easily summarize the data you send to the desktop.

Reporting

SEQUEL offers complete report flexibility to create graphical reports for System i printer output and PC printer output using System i data. You can create sophisticated reports in a fraction of the time normally required.

Drill-Down

SEQUEL offers a number of different drill-down approaches to let you explore both System i data and the information contained in other applications or platforms, including dynamic drill-down that lets you analyze your System i database in ways you never thought possible.

Dashboards

SEQUEL dashboards provide a visual display of the information you use to make your business decisions. Everyone—from executives, to non-technical management, to end users—can create their own dashboards to display key performance indicators.

Special Functions

SEQUEL provides a number of timesaving functions that help you accomplish tasks that used to take multiple query steps, or couldn’t be done without a special program. You can use your System i data as useful business intelligence information—quickly and easily.

Multi-Platform Support

SEQUEL supports real-time data access for remote, multi-platform databases. This gives you unprecedented data analysis functions for DB2, Microsoft SQL Server, ORACLE, MySQL, and others. SEQUEL’s easy-to-use interface makes powerful capabilities, like drill down data analysis, reporting, and executive dashboards available for cross-platform use. You can even drill-down from the data results on one platform to the results on another.

Security

SEQUEL makes it easy everyone to access information on the System i. But, SEQUEL also gives you full control of what information is made available and to whom. You can control and monitor SEQUEL activity using i5/OS Security, Record-Level Security, the Exclusion/Inclusion Dictionary, and Usage History and Auditing.



 

For More Details Click Here
Write Comment (0 comments)

<< Start < Previous 1 2 3 4 5 6 7 8 9 10 Next > End >>

Results 71 - 80 of 626