Question

Input files column are compared on fiesr 2 column, 3rd column of A file - B 3rd column B file shud give subtract count having total 8 TTTTTTTTs for count

 OPTION COPY                                               
 JOINKEYS FILES=F1,FIELDS=(5,4,A,10,20,A)                  
 JOINKEYS FILES=F2,FIELDS=(1,4,A,6,20,A)                   
 REFORMAT FIELDS=(F1:10,20,9,1,5,4,30,1,31,10,F2:27,10)    
 JOIN UNPAIRED,F1                                          
 INREC BUILD=(1,46,27,10,SFF,SUB,37,10,SFF,EDIT=(TTTTTTTT))
 OUTFIL REMOVECC,NODETAIL,                                 
   SECTIONS=(1,54,                                    
             TRAILER3=(1,36,                          
                       ';',                           
                        37,10,                        
                        ';',                          
                        47,7))   

Output gives last column (subtract count of 7 digits where as it shud be 8 characters why is tht its taking 55 column instead of 54 define in SECTIONS = 1,54 and didnt given abend for to added ' ; ', for one ' ; ' it added 1 column from 54 to 55 if u see cols .. for secont added '; ' it simply cut off the last character of file

----+----1----+----2----+----3----+----4----+----5----+
********************************* Top of Data *********
22222222            ;5060;         1;         1;0000000
Was it helpful?

Solution

47,7)) 

You only ask for seven bytes to be copied from the input, so only seven will be copied, not eight.

I can't see any reason for you to be using OUTFIL with SECTIONS for this.

You are defining your control field for the sections as the entire record. If consecutive records are identical, they will appear as one record, without being totalled even. Try to get test data to show that to yourself.

The use of the SFF for the F2 data when an F2 is not present is creative, but makes things less clear. Are your numbers signed anyway? Also, when you SUBtract you are not allowing for a negative result. Can any of your numbers contain more than eight digits? If so, you will get truncation if the result of the SUB gives you more than eight digits.

OPTION COPY                                               
JOINKEYS FILES=F1,FIELDS=(5,4,A,10,20,A)                  
JOINKEYS FILES=F2,FIELDS=(1,4,A,6,20,A)                   
REFORMAT FIELDS=(F1:10,20,9,1,5,4,30,1,31,10,F2:27,10)    
JOIN UNPAIRED,F1                                          
INREC BUILD=(1,36,
             C';',
             37,10,
             C';',
             27,10,SFF,
              SUB,
               37,10,SFF,
              EDIT=(TTTTTTTT))

Alternative formats to SFF that you can use are UFF (for free-format) and FS, for fixed-format, which has an optional floating sign. I think FS fits your requirement best.

In the EDIT pattern T indicates a "significant digit", so leading zeros will be retained. I indicates an "insignificant digit" so leading zeros will appear as blanks.

EDIT=(IIIIIIIT)

There are standard patterns, and many examples of the things you can do with EDIT patterns in you manual.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top