Submitted by Anonymous (not verified) on Sun, 04/20/2014 - 00:00
Forums

Hi,

I have a question regarding IceBreak and the RPG compiler.

See the attached RPG program - line 31 - this causes a compilation failure.

I feel certain that you are aware of the new RPG free format features
(PTF 5770WDS SI51094). However, when I try to use these features in
IceBreak, the RPG compilation fails.

It looks like the pre-compiler is moving the text to the left causing
the compilation to fail (confirmed by looking at QASPSRC).

Are you working on this, or is there a work around I can use?

Another question - I want to investigate C++ with IceBreak. What would
be the best way to start with i5OS C++, is there an idiots guide for
simple folk like me?

Niels Liisberg

Wed, 04/23/2014 - 00:00

Hi;

The new RPG 7.1 in IceBreak is detected if the source contains a “ctl-opt” which also sets the margins for free statements without explicitly using the /free keyword.

I suggest that you use the following highlighted lines in you program prolog for new RPG 7.1 code:

ctl-opt decedit('0.') datfmt(*usa) alwnull(*usrctl)
  bnddir('ICEBREAK') dftactgrp(*no) actgrp('QILE');
 /include qasphdr,IceBreak

dcl-ds emp extName('employees') qualified alias end-ds;
dcl-s totalRows int(10) inz;
dcl-s comma varchar(1) inz;
dcl-s moreRows ind inz('1');
dcl-s fullName varchar(40) inz;
dcl-c YES '1';
dcl-c NO '0';


  // Set content
  setContentType('application/json; charset=utf-8');

  fullName = '//';
  
  declareCursor();
  buildJson();

  *INLR = *ON;
  return;

dcl-proc declareCursor;
  EXEC SQL
  DECLARE      cursor1 CURSOR FOR
    SELECT     employee_id,
         first_name,
         last_name,
        store_id,
         department_id,
        hire_date,
        phone_number,
         hourly_rate,
        commission_pct
      FROM     employees
      WHERE    store_id = 2257 AND
        department_id = 333
      ORDER BY last_name, first_name
      FOR READ ONLY;
end-proc;

dcl-proc buildJson;

  EXEC SQL OPEN cursor1;
  totalRows = sqlca.sqlerrd(2);
  clear comma;
  fetchNext();

  responseWrite( '{' +
      ' "totalRows": '   + %char(totalRows)   +
      ', "rows": [ ');
  doW (moreRows);
    responseWrite(comma + '{' +
      ' "employee_id":'     + %char(emp.employee_id)            +
      ', "store_id":"'      + %char(emp.store_id)               + '"' +
      ', "department_id":"' + %char(emp.department_id)          + '"' +
      ', "first_name":"'    + encodeJsonStr(emp.first_name)     + '"' +
      ', "m_initial":"'     + encodeJsonStr(emp.m_initial)      + '"' +
      ', "last_name":"'     + encodeJsonStr(emp.last_name)      + '"' +
      ', "hire_date":"'     + %char(emp.hire_date : *USA)       + '"' +
      ', "phone_number":'   + %char(emp.phone_number)           +
      ', "hourly_rate":'    + %char(emp.hourly_rate)            +
      ', "commission_pct":' + %editW(emp.commission_pct : '0 .    ') +
 '}'
    );
    comma = ',';
    fetchNext();
  endDo;
  responseWrite( '] }');
  EXEC SQL CLOSE cursor1;

end-proc;

 //----------------------------------------------------
dcl-proc fetchNext;

  EXEC SQL
    FETCH NEXT
      FROM cursor1
      INTO :emp.employee_id,
    :emp.first_name,
    :emp.last_name,
     :emp.store_id,
    :emp.department_id,
     :emp.hire_date,
     :emp.phone_number,
    :emp.hourly_rate,
     :emp.commission_pct;
  monitorSQL();
 end-proc;

 //----------------------------------------------------
dcl-proc monitorSQL;

dcl-c SUCCESSFUL    Const('00000');
dcl-c NO_ROW_FOUND  Const('02000');

  moreRows = NO;

  select;
    when SQLSTATE = SUCCESSFUL;
      moreRows = YES;

    when SQLSTATE = NO_ROW_FOUND;
  endSL;

end-proc;

Best regards,
Niels Liisberg 

Thanks very much Niels,

Ah - Excellent. I knew you guys at system-method would be ahead of the game.

From what build of IceBreak does this apply?

Thanks Niels,

I will make sure the development box is up to that build level and start playing with my new toys.

Beta testing - I will let you know if there are any problems.

Hi Niels,

Build 403 seems to be the current download from the website. Looks like I will need to wait until the later builds are ready.