× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Hex '00' to Hex '40'?
  • From: Buck Calabro <mcalabro@xxxxxxxxxxxx>
  • Date: Tue, 29 Jun 1999 15:25:40 -0400

This one may be a bit tricky.

The contents of the field and the NULL indicator are unrelated to each
other.  WS-LAST-DIFF-SEQ-IND may have a value of zero and be NOT NULL or it
may contain a value of 100 and be NULL.  Even if the value of the field is
x'00', I do not believe this affects the null indicator in any way.  I ran a
quick (ugly) program to test this theory; I'll post it to embarrass myself
in front of the real SQL folks on the list! :-)

F* Test NULL vs x'00'                                   
F* COMMIT(*NONE) OUTPUT(*PRINT) DBGVIEW(*SOURCE)        
                                                        
D FIELD1          S              1                      
D FIELD1Null      s              5i 0 inz               
                                                        
C* Create a table that allows null                      
C/Exec SQL CREATE TABLE BUCK/SQLSAMPLE (FIELD1 CHAR (1))
C/End-Exec                                              
                                                        
C* Put a record with x'00'                              
C/Exec SQL                                              
C+ insert into buck/sqlsample (FIELD1) values(x'00')    
C/End-Exec                                              
                                                        
C* Put a record with 'A'                                
C/Exec SQL                                              
C+ insert into buck/sqlsample (FIELD1) values('A')      
C/End-Exec                                              
                                                        
C* Put a record with NULL                               
C/Exec SQL                                          
C+ insert into buck/sqlsample (FIELD1) values(NULL) 
C/End-Exec                                          
                                                    
C* Define the cursor                                
C/Exec SQL Declare Crsr Cursor for                  
C+ select field1 from buck/sqlsample                
C/End-Exec                                          
                                                    
C* Open the file                                    
C/Exec SQL Open Crsr                                
C/End-Exec                                          
                                                    
C* Read the records                                 
C                   DoU       SqlCod<>0             
C/Exec SQL Fetch Crsr into :FIELD1 :FIELD1Null      
C/End-Exec                                          
C                   If        SQLCOD=0              
C     FIELD1        DSPLY     'BUCK'                
C     FIELD1Null    DSPLY     'BUCK'                
C                   Else                            
C     SqlCod        DSPLY     'BUCK'                
C     SqlSTT        DSPLY     'BUCK'                
C                   EndIf                           
C                   EndDo               
                                        
C* Close the cursor                     
C/Exec SQL Close Crsr                   
C/End-Exec                              
                                        
C* Delete the file                      
C/Exec SQL Drop table buck/sqlsample    
C/End-Exec                              
                                        
C                   Eval      *INLR=*ON 

Buck Calabro

> -----Original Message-----
> From: Howard Weatherly 
> Sent: Tuesday, June 29, 1999 12:04 PM
> To:   MIDRANGE-L@midrange.com
> Subject:      Re: Hex '00' to Hex '40'?
> 
> Brad, Sorry about that last post, a Microsoft moment occured!
> 
> Anyway to continue the x'00' is a null and you need to account for nulls
> in you
> programs:
> 
>  2 WS-LAST-DIFF-SEQ-IND      PIC S9(04) BINARY VALUE ZERO.
> 
>     EXEC SQL FETCH C1 INTO
>        :COPY-TABLE,
>        :LAST-DIFF-SEQUENCE   :WS-LAST-DIFF-SEQ-IND,
>         .
>         .
> In the code you check the indicator variable for a negative to know if the
> field
> is null.
> 
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.