midrange.com code scratchpad
Name:
compilation errors.
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
06/22/2023 01:03:18 pm
IP:
Logged
Description:
Compilation errors:-

*RNF7031 00 11 The name or indicator is not referenced.
*RNF3315 20 2 The Name entry is already defined on a Definition
Specification; defaults to blanks.
*RNF3376 20 1 The parameter for keyword LIKEDS cannot be the same name as
the item being defined.
*RNF3543 20 1 Keyword LIKEDS or LIKEREC is not allowed within a data
structure that is not qualified.
More...
*RNF0637 30 1 An operand was expected but was not found; specification is
ignored.
*RNF0724 30 6 The statement type is out of sequence for the main procedur
*RNF3438 30 1 LIKE keyword is expected but not found; definition is
ignored.
*RNF3531 30 1 Keyword is not allowed with blank-data-structure name.
*RNF5347 30 8 An assignment operator is expected with the EVAL operation.
*RNF5410 30 3 The prototype for the call is not defined.
*RNF7030 30 32 The name or indicator is not defined.
*RNF7503 30 14 Expression contains an operand that is not defined.
*RNF7535 30 1 The type and attributes of the parameter do not match those
of the prototype.
* * * * * E N D O F M E S S A G E S U M M A R Y * * * * *
Code:
  1. **FREE
  2.  
  3. ctl-opt option(*srcstmt:*nodebugio) dftactgrp(*no);
  4.  
  5. // Procedure interface for SubprogramA
  6. dcl-pr SubprogramA EXTPGM('SUBPROGA');
  7.   // Parameters if any
  8. end-pr;
  9.  
  10. // Procedure interface for SubprogramB
  11. dcl-pr SubprogramB EXTPGM('SUBPROGB');
  12.   // Parameters if any
  13. end-pr;
  14.  
  15. // Procedure interface for SubprogramC
  16. dcl-pr SubprogramC extpgm('SUBPROGC');
  17.   // Parameters if any
  18. end-pr;
  19.  
  20. dcl-c SubprogramAValue 'SUBPROGA';
  21. dcl-c SubprogramBValue 'SUBPROGB';
  22. dcl-c SubprogramCValue 'SUBPROGC';
  23.  
  24. // Call Subprogram A
  25. SubprogramA();
  26.  
  27. // Call Subprogram B
  28. SubprogramB();
  29.  
  30. // Call Subprogram C
  31. SubprogramC();
  32.  
  33. *INLR = *ON;
  34.  
  35. // Output file DDS
  36. dcl-ds CallDetails qualified;
  37.   Caller char(10);
  38.   CalledProgram char(10);
  39.   CalledModule char(10);
  40.   CalledModuleLibrary char(10);
  41.   ServiceProgram char(10);
  42.   ServiceProgramLibrary char(10);
  43.   SourceFileLibrary char(10);
  44.   SourceFile char(10);
  45. end-ds;
  46.  
  47. // Call the driver program
  48. dcl-s DriverProgram char(10) inz('DRIVERPRG');
  49. dcl-s ReferenceList likeDS(CallDetails) dim(100);
  50. dcl-s NumReferences packed(10: 0);
  51. dcl-s ErrorFlag ind inz(*Off);
  52.  
  53. callp CallProgramReferences(ReferenceList : NumReferences : DriverProgram);
  54.  
  55. if (NumReferences > 0);
  56.   dsply ('Referenced Programs:');
  57.   for i = 1 to NumReferences;
  58.     dsply ReferenceList(i).CalledProgram;
  59.   endfor;
  60. else;
  61.   dsply 'No referenced programs found for ' + DriverProgram;
  62. endif;
  63.  
  64. if (ErrorFlag);
  65.   dsply 'Errors occurred during program call tracing.';
  66. else;
  67.   dsply 'Program call tracing completed successfully.';
  68. endif;
  69.  
  70. *INLR = *ON;
  71.  
  72. // Subprocedure to retrieve program references
  73. dcl-proc CallProgramReferences;
  74.   dcl-pi *n;
  75.     Receiver likeds(CallDetails) dim(500);
  76.     ReceiverLength packed(10: 0);
  77.     ProgramName char(10) const;
  78.   end-pi;
  79.  
  80.   dcl-s Index packed(10: 0);
  81.   dcl-s NextProgram char(10);
  82.   dcl-ds ProgramInfo qualified based(pProgramInfo);
  83.     ProgramName char(10);
  84.     LibraryName char(10);
  85.     SourceFileLibrary char(10);
  86.     SourceFile char(10);
  87.     NumberOfPrograms packed(10: 0);
  88.     ReferencedPrograms likeds(CallDetails) dim(100);
  89.   end-ds;
  90.  
  91.   // Add current program to the receiver list
  92.   Receiver(Index).Caller = ProgramName;
  93.   Index += 1;
  94.  
  95.   // Call QBNRPRV API to retrieve program references
  96.   callp(E) 'QBNRPRV' (ProgramName : %addr(ProgramInfo) : %size(ProgramInfo));
  97.  
  98.   // Traverse through the received programs and call recursively for each program
  99.   for Index = 1 to ProgramInfo.NumberOfPrograms;
  100.     NextProgram = ProgramInfo.ReferencedPrograms(Index).CalledProgram;
  101.     if (NextProgram <> '');
  102.       // Retrieve program information
  103.       callp(E) GetProgramInfo(ProgramInfo : NextProgram);
  104.  
  105.       // Store the program details in the output file
  106.       Receiver(Index).CalledProgram = NextProgram;
  107.       Receiver(Index).CalledModule = ProgramInfo.ReferencedPrograms(Index).CalledModule;
  108.       Receiver(Index).CalledModuleLibrary = ProgramInfo.ReferencedPrograms(Index).CalledModuleLibrary;
  109.       Receiver(Index).ServiceProgram = ProgramInfo.ReferencedPrograms(Index).ServiceProgram;
  110.       Receiver(Index).ServiceProgramLibrary = ProgramInfo.ReferencedPrograms(Index).ServiceProgramLibrary;
  111.       Receiver(Index).SourceFileLibrary = ProgramInfo.SourceFileLibrary;
  112.       Receiver(Index).SourceFile = ProgramInfo.SourceFile;
  113.  
  114.       // Call recursively for the called program
  115.       callp(E) CallProgramReferences(Receiver : ReceiverLength : NextProgram);
  116.     endif;
  117.   endfor;
  118.  
  119.   ReceiverLength = Index - 1;
  120.   return;
  121. end-proc;
  122.  
  123. // Subprocedure to retrieve program information
  124. dcl-proc GetProgramInfo;
  125.   dcl-pi *n;
  126.     ProgramInfo likeds(ProgramInfo);
  127.     ProgramName char(10) const;
  128.   end-pi;
  129.  
  130.   dcl-ds ProgramInfo qualified based(pProgramInfo);
  131.     ProgramName char(10);
  132.     LibraryName char(10);
  133.     SourceFileLibrary char(10);
  134.     SourceFile char(10);
  135.     NumberOfPrograms packed(10: 0);
  136.     ReferencedPrograms likeds(CallDetails) dim(100);
  137.   end-ds;
  138.  
  139.   dcl-s ReturnCode packed(10: 0);
  140.  
  141.   callp(E) 'QCLRPGMI' (ProgramName : %addr(ProgramInfo) : %size(ProgramInfo) : ReturnCode);
  142.  
  143.   return;
  144. end-proc;
  145.  
© 2004-2019 by midrange.com generated in 0.004s valid xhtml & css