BrianGarland / vscode-rpgfree

Visual Studio Code extension to convert fixed format RPGLE to free format
MIT License
18 stars 11 forks source link

Fails to correctly convert /QIBM/ProdData/OS/WebServices/samples/server/ConvertTemp/CNVRTTMP.RPGLE #103

Closed jwoehr closed 2 months ago

jwoehr commented 3 months ago

The IBM IWS REST API in RPGLE sample at /QIBM/ProdData/OS/WebServices/samples/server/ConvertTemp/CNVRTTMP.RPGLE does not correctly convert.

BrianGarland commented 2 months ago

@jwoehr Thanks for noting this. I can see the h-spec continuation problem. Is there anything other than that?

BrianGarland commented 2 months ago

0.0.31 should resolve this issue with H-Specs.

jwoehr commented 2 months ago

@jwoehr Thanks for noting this. I can see the h-spec continuation problem. Is there anything other than that?

Thanks @BrianGarland ... No, that was my problem ... the copyright block barfing on the continuations.

jwoehr commented 2 months ago

Brian, I just tried with the latest release of the extension. Works for me, thanks!

jwoehr commented 2 months ago

Oops, I spoke too soon. The converted output looks good but does not compile. Converting /QIBM/ProdData/OS/WebServices/samples/server/ConvertTemp/CNVRTTMP.RPGLE and running CRTRPGMOD yields the following spooled output:

Running Action: Create RPG Module (CRTRPGMOD) (7:23:27 PM)
Current library: QGPL
Library list: QGPL QTEMP
Working directory: /home/JWOEHR
Commands:
    CRTRPGMOD MODULE(NAVIGATE24/CNVRTTMP) SRCSTMF('/home/JWOEHR/work/NAViGATE_2024_Code/IWS/CNVRTTMP.RPGLE') OPTION(*EVENTF) DBGVIEW(*SOURCE) TGTRLS(*CURRENT) TGTCCSID(*JOB)

CPFA0A9:  Object not found.  Object is EN_US.UTF-8.
CPD4090:  Printer device PRT01 not found. Output queue changed to QPRINT in library QGPL.
CPFA0A9:  Object not found.  Object is EN_US.UTF-8.
CPFA0A9:  Object not found.  Object is EN_US.UTF-8.
RNS9308:  Compilation stopped. Severity 30 errors found in program.
CPC0904:  Data area RETURNCODE created in library QTEMP.
RNS9309:  Compilation failed. Module CNVRTTMP not created in library NAVIGATE24.
  5770WDS V7R5M0  220415 RN        IBM ILE RPG             NAVIGATE24/CNVRTTMP      VP24X001   07/21/24 01:30:30        Page      1
   Command  . . . . . . . . . . . . :   CRTRPGMOD
     Issued by  . . . . . . . . . . :     JWOEHR
   Module . . . . . . . . . . . . . :   CNVRTTMP
     Library  . . . . . . . . . . . :     NAVIGATE24
   Text 'description' . . . . . . . :   *SRCMBRTXT
   Source stream file   . . . . . . :   /home/JWOEHR/work/NAViGATE_2024_Code/IWS/CNVRTTMP.
                                        RPGLE
     CCSID  . . . . . . . . . . . . :     819
   Target CCSID . . . . . . . . . . :   *JOB (37)
   Text 'description' . . . . . . . :
   Last Change  . . . . . . . . . . :   07/21/24  01:21:37
   Generation severity level  . . . :   10
   Compiler options . . . . . . . . :   *XREF      *GEN       *NOSECLVL  *SHOWCPY
                                        *EXPDDS    *EXT       *NOSHOWSKP *NOSRCSTMT
                                        *DEBUGIO   *UNREF     *EVENTF
   Debugging views  . . . . . . . . :   *SOURCE
   Debug encryption key . . . . . . :   *NONE
   Output . . . . . . . . . . . . . :   *PRINT
   Optimization level . . . . . . . :   *NONE
   Source listing indentation . . . :   *NONE
   Type conversion options  . . . . :   *NONE
   Sort sequence  . . . . . . . . . :   *HEX
   Language identifier  . . . . . . :   *JOBRUN
   Replace module . . . . . . . . . :   *YES
   Authority  . . . . . . . . . . . :   *LIBCRTAUT
   Truncate numeric . . . . . . . . :   *YES
   Fix numeric  . . . . . . . . . . :   *NONE
   Target release . . . . . . . . . :   *CURRENT
   Allow null values  . . . . . . . :   *NO
   Storage model . . .  . . . . . . :   *INHERIT
   Binding directory  . . . . . . . :   *NONE
   Define condition names . . . . . :   *NONE
   Enable performance collection  . :   *PEP
   Profiling data . . . . . . . . . :   *NOCOL
   Licensed Internal Code options . :
   Generate program interface . . . :   *NO
   Include directory  . . . . . . . :
   Preprocessor options . . . . . . :   *NONE
   Require prototype for export . . :   *NO
  5770WDS V7R5M0  220415 RN        IBM ILE RPG             NAVIGATE24/CNVRTTMP      VP24X001   07/21/24 01:30:30        Page      2
 Line   <---------------------- Source Specifications ----------------------------><---- Comments ----> Do  Page  Change Src Seq
 Number ....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+...10 Num Line  Date   Id  Number
                           S o u r c e   L i s t i n g
      1   Ctl-Opt nomain PGMINFO(*PCML:*MODULE) THREAD(*SERIALIZE);                                                          000001
      2   Ctl-Opt COPYRIGHT('+                                                                                               000002
      3           5722SS1, 5761SS1 (C) Copyright IBM Corp. 2007, 2007. All rights +                                          000003
      4           reserved. US Government Users Restricted Rights - Use, duplication +                                       000004
 ======>                                                                          a
 *RNF0267 20 a      000004  Character literal has missing trailing apostrophe; trailing
                            apostrophe assumed.
 *RNF5501 20      4 000004  The comment entry on a free-form specification is not
                            valid.
      5           or disclosure restricted by GSA ADP Schedule Contract with +                                               000005
 ======>          aa bbbbbbbbbb cccccccccc dd eee fff gggggggg hhhhhhhh iiii j
 *RNF0312 20 a      000005  A right parenthesis is expected but is not found.
 *RNF0607 00 b      000005  Text is skipped to recover from the previous error.
 *RNF1301 20 c      000005  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 d      000005  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 e      000005  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 f      000005  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 g      000005  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 h      000005  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 i      000005  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 j      000005  A keyword is not recognized; the keyword is ignored.
      6           IBM Corp. Licensed Materials-Property of IBM');                                                            000006
 ======>          aaa     b eeeeeeee ffffffffffffffffff gg hhhj                   i
 ======>                  c
 ======>              ddddd
 *RNF1301 20 a      000006  A keyword is not recognized; the keyword is ignored.
 *RNF0622 20 b      000006  A qualified name is not allowed in this context.
 *RNF0623 20 c      000006  The simple qualified name is not specified correctly.
 *RNF1301 20 d      000006  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 e      000006  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 f      000006  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 g      000006  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 h      000006  A keyword is not recognized; the keyword is ignored.
 *RNF0267 20 i      000006  Character literal has missing trailing apostrophe; trailing
                            apostrophe assumed.
 *RNF1301 20 j      000006  A keyword is not recognized; the keyword is ignored.
      7    //********************************************************************                                            000007
      8    //                                                                   *                                            000008
      9    //                  IBM Web Services Client for C/C++                *                                            000009
     10    //                                                                   *                                            000010
     11    //  FILE NAME:      CNVRTTMP.RPGLE                                   *                                            000011
     12    //                                                                   *                                            000012
     13    //  DESCRIPTION:    Source for ConvertTemp Web service               *                                            000013
     14    //                                                                   *                                            000014
     15    //********************************************************************                                            000015
     16    // LICENSE AND DISCLAIMER                                            *                                            000016
     17    // ----------------------                                            *                                            000017
     18    // This material contains IBM copyrighted sample programming source  *                                            000018
     19    // code ( Sample Code ).                                             *                                            000019
     20    // IBM grants you a nonexclusive license to compile, link, execute,  *                                            000020
     21    // display, reproduce, distribute and prepare derivative works of    *                                            000021
     22    // this Sample Code.  The Sample Code has not been thoroughly        *                                            000022
     23    // tested under all conditions.  IBM, therefore, does not guarantee  *                                            000023
  5770WDS V7R5M0  220415 RN        IBM ILE RPG             NAVIGATE24/CNVRTTMP      VP24X001   07/21/24 01:30:30        Page      3
 Line   <---------------------- Source Specifications ----------------------------><---- Comments ----> Do  Page  Change Src Seq
 Number ....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+...10 Num Line  Date   Id  Number
     24    // or imply its reliability, serviceability, or function. IBM        *                                            000024
     25    // provides no program services for the Sample Code.                 *                                            000025
     26    //                                                                   *                                            000026
     27    // All Sample Code contained herein is provided to you "AS IS"       *                                            000027
     28    // without any warranties of any kind. THE IMPLIED WARRANTIES OF     *                                            000028
     29    // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND             *                                            000029
     30    // NON-INFRINGMENT ARE EXPRESSLY DISCLAIMED.                         *                                            000030
     31    // SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED          *                                            000031
     32    // WARRANTIES, SO THE ABOVE EXCLUSIONS MAY NOT APPLY TO YOU.  IN NO  *                                            000032
     33    // EVENT WILL IBM BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT,   *                                            000033
     34    // SPECIAL OR OTHER CONSEQUENTIAL DAMAGES FOR ANY USE OF THE SAMPLE  *                                            000034
     35    // CODE INCLUDING, WITHOUT LIMITATION, ANY LOST PROFITS, BUSINESS    *                                            000035
     36    // INTERRUPTION, LOSS OF PROGRAMS OR OTHER DATA ON YOUR INFORMATION  *                                            000036
     37    // HANDLING SYSTEM OR OTHERWISE, EVEN IF WE ARE EXPRESSLY ADVISED OF *                                            000037
     38    // THE POSSIBILITY OF SUCH DAMAGES.                                  *                                            000038
     39    //                                                                   *                                            000039
     40    //                                                  *                                            000040
     41    //                                                                   *                                            000041
     42    //  Licensed Materials - Property of IBM                             *                                            000042
     43    //                                                                   *                                            000043
     44    //  5722-SS1, 5761-SS1                                               *                                            000044
     45    //                                                                   *                                            000045
     46    //  (c) Copyright IBM Corp. 2007, 2007                               *                                            000046
     47    //  All Rights Reserved                                              *                                            000047
     48    //                                                                   *                                            000048
     49    //  U.S. Government Users Restricted Rights - use,                   *                                            000049
     50    //  duplication or disclosure restricted by GSA                      *                                            000050
     51    //  ADP Schedule Contract with IBM Corp.                             *                                            000051
     52    //                                                                   *                                            000052
     53    //  Status: Version 1 Release 0                                      *                                            000053
     54    //                                                    *                                            000054
     55    //                                                                   *                                            000055
     56    //********************************************************************                                            000056
     57   Dcl-PR ConvertTemp;                                                                                                000057
 ======>  aaaaaa bbbbbbbbbbb
 *RNF1301 20 a      000057  A keyword is not recognized; the keyword is ignored.
 *RNF1301 20 b      000057  A keyword is not recognized; the keyword is ignored.
     58      //****************************************                                                                      000058
         *--------------------------------------------------------------------*
         * Compiler Options in Effect:                                        *
         *--------------------------------------------------------------------*
         *  Text 'description' . . . . . . . :                                *
         *  Generation severity level  . . . :   10                           *
         *  Compiler options . . . . . . . . :   *XREF      *GEN              *
         *                                       *NOSECLVL  *SHOWCPY          *
         *                                       *EXPDDS    *EXT              *
         *                                       *NOSHOWSKP *NOSRCSTMT        *
         *                                       *DEBUGIO   *UNREF            *
         *                                       *EVENTF                      *
         *  Optimization level . . . . . . . :   *NONE                        *
         *  Source listing indentation . . . :   *NONE                        *
         *  Type conversion options  . . . . :   *NONE                        *
         *  Sort sequence  . . . . . . . . . :   *HEX                         *
         *  Language identifier  . . . . . . :   *JOBRUN                      *
         *  Authority  . . . . . . . . . . . :   *LIBCRTAUT                   *
  5770WDS V7R5M0  220415 RN        IBM ILE RPG             NAVIGATE24/CNVRTTMP      VP24X001   07/21/24 01:30:30        Page      4
 Line   <---------------------- Source Specifications ----------------------------><---- Comments ----> Do  Page  Change Src Seq
 Number ....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+...10 Num Line  Date   Id  Number
         *  Truncate numeric . . . . . . . . :   *YES                         *
         *  Fix numeric  . . . . . . . . . . :   *NONE                        *
         *  Allow null values  . . . . . . . :   *NO                          *
         *  Storage model . . .  . . . . . . :   *INHERIT                     *
         *  Binding directory from Command . :   *NONE                        *
         *  Binding directory from Source  . :   *NONE                        *
         *  Enable performance collection  . :   *PEP                         *
         *  Profiling data . . . . . . . . . :   *NOCOL                       *
         *  Program interface information:                                    *
         *    Generate . . . . . . . . . . . :   *PCML                        *
         *    Location . . . . . . . . . . . :   *MODULE                      *
         *  Require prototype for export . . :   *NO                          *
         *--------------------------------------------------------------------*
     59     tempIn         Char(10)   CONST;                                                                                 000059
 ======>    aaaaaa         bbbb
 *RNF5418 30 a      000059  The operation entry is not allowed in the main source
                            section in a non-cycle module.
 *RNF5347 30 b      000059  An assignment operator is expected with the EVAL operation.
     60     tempOut        Char(10);                                                                                         000060
 ======>    aaaaaaa        bbbb
 *RNF5418 30 a      000060  The operation entry is not allowed in the main source
                            section in a non-cycle module.
 *RNF5347 30 b      000060  An assignment operator is expected with the EVAL operation.
     61      //****************************************                                                                      000061
     62    End-PR;                                                                                                           000062
 ======>   aaaaaa
 *RNF0724 30 a      000062  The statement type is out of sequence for the main
                            procedure.
     63   Dcl-Proc ConvertTemp export;                                                                                       000063
     64      //****************************************                                                                      000064
     65     Dcl-PI ConvertTemp;                                                                                              000065
     66       tempIn         Char(10)   CONST;                                                                               000066
     67       tempOut        Char(10);                                                                                       000067
     68        //****************************************                                                                    000068
     69      End-PI;                                                                                                         000069
     70     Dcl-S tempI        Packed(8:2);                                                                                  000070
     71     Dcl-S tempO        Packed(8:2);                                                                                  000071
     72     Dcl-S value        Char(50);                                                                                     000072
     73   value = %STR(%ADDR(tempIn));                                                                                       000073
     74   tempI=%DEC(value:7:2);                                                                                             000074
     75   tempO = (5/9)*(tempI - 32);                                                                                        000075
     76   value = %CHAR(tempO);                                                                                              000076
     77   tempOut = value;                                                                                                   000077
     78   %STR(%ADDR(tempOut):10)=tempOut;                                                                                   000078
     79   End-Proc;                                                                                                          000079
        * * * * *   E N D   O F   S O U R C E   * * * * *
  5770WDS V7R5M0  220415 RN        IBM ILE RPG             NAVIGATE24/CNVRTTMP      VP24X001   07/21/24 01:30:30        Page      5
           A d d i t i o n a l   D i a g n o s t i c   M e s s a g e s
  Msg id  Sv Number Seq     Message text
 *RNF7030 30     59 000059  The name or indicator CHAR is not defined.
 *RNF7030 30     59 000059  The name or indicator TEMPIN is not defined.
 *RNF7030 30     60 000060  The name or indicator TEMPOUT is not defined.
  * * * * *   E N D   O F   A D D I T I O N A L   D I A G N O S T I C   M E S S A G E S   * * * * *
  5770WDS V7R5M0  220415 RN        IBM ILE RPG             NAVIGATE24/CNVRTTMP      VP24X001   07/21/24 01:30:30        Page      6
                           C r o s s   R e f e r e n c e
       File and Record References:
          File              Device             References (D=Defined)
            Record
          No references in the source.
       Global Field References:
          Field             Attributes         References (D=Defined M=Modified)
          CONVERTTEMP       PROTOTYPE              63      65
 *RNF7030 TEMPIN            **UNDEF**              59M
 *RNF7030 TEMPOUT           **UNDEF**              60M
       Field References for subprocedure CONVERTTEMP
          Field             Attributes         References (D=Defined M=Modified)
          TEMPI             P(8,2)                 70D     74M     75
          TEMPIN            A(10)                  66D     73
          TEMPO             P(8,2)                 71D     75M     76
          TEMPOUT           A(10)                  67D     77M     78M     78
          VALUE             A(50)                  72D     73M     74      76M
                                                   77
       Indicator References:
          Indicator                            References (D=Defined M=Modified)
        * * * * *   E N D   O F   C R O S S   R E F E R E N C E   * * * * *
  5770WDS V7R5M0  220415 RN        IBM ILE RPG             NAVIGATE24/CNVRTTMP      VP24X001   07/21/24 01:30:30        Page      7
                       E x t e r n a l   R e f e r e n c e s
       Statically bound procedures:
          Procedure                            References
          No references in the source.
       Imported fields:
          Field             Attributes         Defined
          No references in the source.
       Exported fields:
          Field             Attributes         Defined
          No references in the source.
    * * * * *   E N D   O F   E X T E R N A L   R E F E R E N C E S   * * * * *
  5770WDS V7R5M0  220415 RN        IBM ILE RPG             NAVIGATE24/CNVRTTMP      VP24X001   07/21/24 01:30:30        Page      8
                           M e s s a g e   S u m m a r y
  Msg id  Sv Number Message text
 *RNF0607 00      1 Text is skipped to recover from the previous error.
 *RNF0267 20      2 Character literal has missing trailing apostrophe; trailing
                    apostrophe assumed.
 *RNF0312 20      1 A right parenthesis is expected but is not found.
 *RNF0622 20      1 A qualified name is not allowed in this context.
 *RNF0623 20      1 The simple qualified name is not specified correctly.
 *RNF1301 20     17 A keyword is not recognized; the keyword is ignored.
 *RNF5501 20      1 The comment entry on a free-form specification is not valid.
 *RNF0724 30      1 The statement type is out of sequence for the main procedure.
 *RNF5347 30      2 An assignment operator is expected with the EVAL operation.
 *RNF5418 30      2 The operation entry is not allowed in the main source section
                    in a non-cycle module.
 *RNF7030 30      3 The name or indicator is not defined.
        * * * * *   E N D   O F   M E S S A G E   S U M M A R Y   * * * * *
  5770WDS V7R5M0  220415 RN        IBM ILE RPG             NAVIGATE24/CNVRTTMP      VP24X001   07/21/24 01:30:30        Page      9
                             F i n a l   S u m m a r y
   Message Totals:
     Information  (00) . . . . . . . :        1
     Warning      (10) . . . . . . . :        0
     Error        (20) . . . . . . . :       23
     Severe Error (30+)  . . . . . . :        8
     ---------------------------------  -------
     Total . . . . . . . . . . . . . :       32
   Source Totals:
     Records . . . . . . . . . . . . :       79
     Specifications  . . . . . . . . :       22
     Data records  . . . . . . . . . :        0
     Comments  . . . . . . . . . . . :       55
          * * * * *   E N D   O F   F I N A L   S U M M A R Y   * * * * *
 Compilation stopped. Severity 30 errors found in program.
           * * * * *   E N D   O F   C O M P I L A T I O N   * * * * *

Fetching errors for NAVIGATE24/CNVRTTMP.
jwoehr commented 2 months ago

I see the problem @BrianGarland ... The comment is too long. If I take the converted output and align the continuation lines to the left margin so that spaces are not inserted from the left inside the string, it comes in under the 256-character maximum for the Ctl-Opt COPYRIGHT('string') and it compiles. image

BrianGarland commented 2 months ago

That's weird. I did compile it at one point. This is a pretty easy fix!

BrianGarland commented 2 months ago

I see why it worked for me. I've been using F1, Convert to Free instead of highlighting. When using F1 it converts the whole source member, adds the **FREE, and then calls the formatter. So, in my case, everything was shifted left enough to compile.

I've changed the conversion so that the continuation lines will start under the C of ctl-opt so it should work either way.

0.0.32 should be available soon.

jwoehr commented 2 months ago

Thanks @BrianGarland