midrange.com code scratchpad
Name:
IFS GIF Image To Spool File Using QIMGCVTI
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
01/12/2016 06:19:00 pm
IP:
Logged
Description:
Using the QimgCvtImg API example
Code:
  1.  * First add binding directory entry for service program QIMBCIMG service program found in QSYS.  
  2.  
  3. H BNDDIR('YOURDIRECTORYOFCHOICE')                                                       
  4. H DftActGrp(*NO)                                                                        
  5.                                                                                         
  6. D RunCommand      PR            10I 0 Extproc('system')                                 
  7. D   CmdString                     *   Value                                             
  8. D                                     Options(*String)                                  
  9.  ***********                                                                            
  10.  *                                                                                      
  11.  * DESCRIPTION OF FIELDS CAN BE FOUND HERE.                                             
  12.  *  http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/apis/QIMGCVTI.htm?lang=en
  13.  *                                                                                      
  14.  ***********                                                                            
  15. D QImgCvtImg      PR                  ExtProc('QimgCvtImg')                             
  16. D  Control                        *   value options(*string)                            
  17. D  Input                          *   value options(*string)                            
  18. D  MainInputStor                  *   value options(*string)                            
  19. D  Output                         *   value options(*string)                            
  20. D  MainOutptStor                  *   value options(*string)                            
  21. D  FeedBack                       *   value options(*string)                            
  22.  
  23. D  ErrorCode                      *   value options(*string)                      
  24.                                                                                   
  25.  * Format IMGC0100                                                                
  26. D Control         DS                  Qualified                                   
  27. D  Length                 1      4B 0 Inz(100)                                    
  28. D  Format                 5     12    Inz('IMGC0100')                             
  29. D  Operation             13     16B 0 Inz(0)                                      
  30. D  MultiPageOutput...                                                             
  31. D                        17     48    Inz(*LOVAL)                                 
  32. D  SpaceForFeedBack...                                                            
  33. D                        49     52B 0 Inz(0)                                      
  34. D  FeedBackStructure...                                                           
  35. D                        53     60    Inz('IMGF0100')                             
  36. D  Reverse               61     64B 0 Inz(0)                                      
  37. D  ColorReduction...                                                              
  38. D                        65     68B 0 Inz(0)                                      
  39. D  Resize                69     72B 0 Inz(0)                                      
  40. D  Stretch               73     76B 0 Inz(0)                                      
  41. D  HorizontalJustify...                                                           
  42. D                        77     80B 0 Inz(0)                                      
  43. D  VerticalJustify...                                                
  44. D                        81     84B 0 Inz(0)                         
  45. D  KeepColor             85     88B 0 Inz(0)                         
  46. D  KeepQuality           89     92B 0 Inz(1)                         
  47. D  CancelOnError         93     96B 0 Inz(1)                         
  48. D  SeverityLevel         97    100B 0 Inz(30)                        
  49.                                                                      
  50.  * Format IMGI0100                                                   
  51. D Stream          DS                  Qualified                      
  52. D  Length                 1      4B 0 Inz(94)                        
  53. D  Format                 5     12    Inz('IMGI0100')                
  54. D  Reserved1             13     32    Inz(*LOVAL)                    
  55. D  DataStreamFormat...                                               
  56. D                        33     36B 0 Inz(0)                         
  57. D  PhotometricInterpretation...                                      
  58. D                        37     40B 0 Inz(0)                         
  59. D  ResolutionUnits...                                                
  60. D                        41     44B 0 Inz(0)                         
  61. D  HorizontalResolution...                                           
  62. D                        45     48B 0 Inz(0)                         
  63. D  VerticalResolution...                                                    
  64. D                        49     52B 0 Inz(0)                                
  65. D  InputObjectType...                                                       
  66. D                        53     56B 0 Inz(0)                                
  67. D  OffsetToInputObjectName...                                               
  68. D                        57     60B 0 Inz(68)                               
  69. D  LengthOfInputObjectName...                                               
  70. D                        61     64B 0 Inz(26)                               
  71. D  Reserved2...                                                             
  72. D                        65     68B 0 Inz(0)                                
  73. D  InputObjectName...                                                       
  74. D                        69     94    Inz('/home/xxxxxxx/image.gif')     
  75.                                                                             
  76.  * Format IMGO0200                                                          
  77. D Output          DS                  Qualified                             
  78. D  Length                 1      4B 0 Inz(200)                              
  79. D  Format                 5     12    Inz('IMGO0200')                       
  80. D  DestinationImageConfig...                                                
  81. D                        13     22    Inz('*DEV')                           
  82. D  Reserved1...                                                             
  83. D                        23     32    Inz(*LOVAL)        
  84. D  DataStreamFormat...                                   
  85. D                        33     36B 0 Inz(0)             
  86. D  PhotometricInterpretation...                          
  87. D                        37     40B 0 Inz(0)             
  88. D  ResolutionUnits...                                    
  89. D                        41     44B 0 Inz(0)             
  90. D  HorizontalResolution...                               
  91. D                        45     48B 0 Inz(0)             
  92. D  VerticalResolution...                                 
  93. D                        49     52B 0 Inz(0)             
  94. D  SizeUnits...                                          
  95. D                        53     56B 0 Inz(0)             
  96. D  HorizontalSize...                                     
  97. D                        57     64P 5 Inz(0)             
  98. D  VerticalSize...                                       
  99. D                        65     72P 5 Inz(0)             
  100. D  CompressionType...                                    
  101. D                        73     76B 0 Inz(0)             
  102. D  CompressionQuality...                                 
  103. D                        77     80B 0 Inz(0)          
  104. D  BitsPerSample...                                   
  105. D                        81     84B 0 Inz(0)          
  106. D  PaperSize...                                       
  107. D                        85     88B 0 Inz(0)          
  108. D  UserPaperSizeUnits...                              
  109. D                        89     92B 0 Inz(0)          
  110. D  HorizontalUserPaperSize...                         
  111. D                        93    100P 5 Inz(0)          
  112. D  VerticalUserPaperSize...                           
  113. D                       101    108P 5 Inz(0)          
  114. D  PaperOrientation...                                
  115. D                       109    112B 0 Inz(-1)         
  116. D  LeftUnprintableBorder...                           
  117. D                       113    116B 0 Inz(-1)         
  118. D  RightUnprintableBorder...                          
  119. D                       117    120B 0 Inz(-1)         
  120. D  TopUnprintableBorder...                            
  121. D                       121    124B 0 Inz(-1)         
  122. D  BottomUnprintableBorder...                         
  123. D                       125    128B 0 Inz(-1)           
  124. D  OutputDevice...                                      
  125. D                       129    138    Inz('YOUR PRINTER') 
  126. D  OutputQueue...                                       
  127. D                       139    148    Inz('*DEV')       
  128. D  OutputQueueLib...                                    
  129. D                       149    158    Inz('*LIBL')      
  130. D  PrinterFile...                                       
  131. D                       159    168    Inz('QSYSPRT')    
  132. D  PrinterFileLib...                                    
  133. D                       169    178    Inz('*LIBL')      
  134. D  UserData...                                          
  135. D                       179    188    Inz('*INOBJ')     
  136. D  Copies...                                            
  137. D                       189    192B 0 Inz(0)            
  138. D  Save...                                              
  139. D                       193    196B 0 Inz(0)            
  140. D  RequestSpooledFeedback...                            
  141. D                       197    200B 0 Inz(1)            
  142. D Feedback        DS                  Qualified    
  143. D  Multipage              1     32                 
  144. D  SpoolFile             33     42                 
  145. D  JobName               43     52                 
  146. D  JobUser               53     62                 
  147. D  JobNumber             63     68                 
  148. D  SpoolNumber           69     72B 0              
  149. D  IntJobID              73     88                 
  150. D  IntSpoolID            89    104                 
  151. D  OutputDataLen        105    108B 0              
  152. D  SysName              109    116                 
  153. D  SpoolDate            117    123                 
  154. D  Reserved             124    124                 
  155. D  SpoolTime            125    130                 
  156. D  Reserve2             131    132                 
  157.                                                    
  158. DQUSEC            DS                               
  159. D QUSBPRV                 1      4B 0 INZ          
  160. D QUSBAVL                 5      8B 0 INZ          
  161. D QUSEI                   9     15    INZ          
  162. D QUSERVED               16     16    INZ                                          
  163. D QUSED01                17    144    INZ                                          
  164.                                                                                    
  165. D inputbuf        s          65535a                                                
  166. D outputbuf       s          65535a                                                
  167.  /Free                                                                             
  168.                                                                                    
  169.   runcommand('OVRPRTF QSYSPRT DEVTYPE(*USERASCII)');                               
  170.   // Since I'm using a stream file, these two values must be *LOVAL X'00' for all  
  171.   inputBuf = *LOVAL;                                                               
  172.   outputbuf = *LOVAL;                                                              
  173.   QImgCvtImg(                                                                      
  174.     Control                                                                        
  175.    :Stream                                                                         
  176.    :InputBuf                                                                       
  177.    :Output                                                                         
  178.    :OutputBuf                                                                      
  179.    :Feedback                                                                       
  180.    :QUSEC                                                                          
  181.   );                                                                               
  182.   RunCommand('DLTOVR FILE(QSYSPRT)');                
  183.                                                      
  184.   *InLR = *On;                                       
  185.   Return;                                            
  186.  /End-Free                                           
© 2004-2019 by midrange.com generated in 0.014s valid xhtml & css