Submitted by Kaj Vang Jensen on Tue, 01/03/2012 - 11:28
Forums

We have learnt, that some customers who uses COBOL have problems sending SMS using the API. 

The problem is, that you need to set the actual lenght in the first two bytes in the text you want to send. You can find a COBOL program example in QSAMPLE  (EKS007CBL) - or copy/paste from here:
 

       PROCESS APOST BLK DATETIME FS9MTO0M     
               NOUNREF  VARCHAR.                                      
       IDENTIFICATION DIVISION.                                       
       PROGRAM-ID. EKS007CBL.                                         
       ENVIRONMENT DIVISION.                                          
       DATA DIVISION.                                                 
       WORKING-STORAGE SECTION.         
       01  W-DIVERSE.                                                 
           05  W-PGM                   PIC X(10) VALUE 'ÆSNDSMSM'.    
           05  PMTEXT.                                                
               10  W-LGD               PIC 9(4) COMP-4 VALUE 200.     
               10  W-TXT               PIC X(254).                    
           05  PMRPRF                  PIC X(10).                     
           05  PMMPFX                  PIC X(05).                     
           05  PMTMPN                  PIC X(15).                     
           05  PMMSGT                  PIC S9(01) COMP-3.    
           05  PMSCTS                  PIC X(26).                     
           05  PMMSID                  PIC X(07).                     
           05  PMMSGF                  PIC X(10).                     
           05  PMMSFL                  PIC X(10).                  
           05  PMMDTA                  PIC X(160).                  
           05  PMCKLY                  PIC X(01).                  
           05  PMSNUS                  PIC X(10).                  
      
       PROCEDURE DIVISION.                                          
      *                                                            
      /*************************************************************
      *                                                            
      *    MAIN section                                            
      *                                                            
      **************************************************************
      *                                                            
       MAIN SECTION.                                               
       MAIN00.                                                     
                                                                    
           MOVE  'Hello from BlueNote' TO W-TXT.         
           PERFORM VARYING W-LGD FROM LENGTH OF W-TXT BY -1        
           UNTIL W-LGD                    < 1                      
           OR    W-TXT(W-LGD:1)       NOT = SPACE                  
                 CONTINUE                                  
           END-PERFORM.                                    
           MOVE  ALL SPACE               TO PMRPRF         
           MOVE  '45'                    TO PMMPFX.        
           MOVE  '12345678'              TO PMTMPN.        
           MOVE  1                       TO PMMSGT.        
           MOVE  '2020-12-24-09.30.00.000000'              
                                         TO PMSCTS.        
           MOVE  ALL SPACE               TO PMMSID.  
           MOVE  ALL SPACE               TO PMMSGF.        
           MOVE  ALL SPACE               TO PMMSFL.        
           MOVE  ALL SPACE               TO PMMDTA.         
           MOVE  '0'                     TO PMCKLY.        
           MOVE  '*DFT'                  TO PMSNUS.        

           CALL W-PGM      USING            PMTEXT         
                                            PMRPRF         
                                            PMMPFX         
                                            PMTMPN         
                                            PMMSGT         
                                            PMSCTS         
                                            PMMSID         
                                            PMMSGF         
                                            PMMSFL         
                                            PMMDTA         
                                            PMCKLY         
                                            PMSNUS.        
       MAIN90.                                             
           GOBACK.