Arithemtic with &TIME1



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Arithemtic with &TIME1

Postby golemis » Mon Dec 16, 2019 7:39 pm

Hi team,
I need to check the last record of a VSAM file, which contains a date/time stamp and the time is in pos(7,6), to be within 10 minutes of current time.
I am using ICETOOL with:
//TOOLIN   DD *
   SUBSET FROM(IN1) TO(OUT1) INPUT KEEP LAST USING(CTL1)
/*
//CTL1CNTL DD *
   OPTION COPY
  OUTFIL BUILD=(&TIME1,4X,7,6)
/*

which prints the two times and then the user could compare.
However, when I try to do the subtration, so I can only print the difference (and subsequently automatically raise alerts of not), I try the following in CTL1CNTL:
OUTFIL BUILD=(&TIME1,UFF,SUB,7,6,UFF)

and it failes with SYNTAX ERROR
           OUTFIL BUILD=(&TIME1,UFF,SUB,7,6,UFF)
                                £
ICE007A 1 SYNTAX ERROR

Any hints on how better I would do the arithmetic?
Thanks GG
golemis
 
Posts: 34
Joined: Wed Apr 04, 2018 8:13 pm
Location: London, UK
Has thanked: 10 times
Been thanked: 0 time

Re: Arithemtic with &TIME1

Postby sergeyken » Thu Dec 19, 2019 7:19 pm

1. This way of doing any arithmetic with time values is absolutely senseless!

2. If you really need to perform some operations with data values created by SORT &-parameters, you would need to do this either in separate INREC/OUTREC/OUTFIL statements, or in separate parameters IFTHEN=(WHEN=INIT,BUILD=(…)) of any single statement
//*==============================================================
//TIME     EXEC  PGM=SORT                                        
//SYSOUT   DD    SYSOUT=*                                        
//SORTIN   DD    *                                              
      123456                                                    
//*-+----1----+----2----+----3----+----4----+----5----+----6----+
//SORTOUT  DD    SYSOUT=*                                        
//SYSIN    DD *                                                  
 INREC BUILD=(&TIME1,X,7,6,50X)                                  
 SORT FIELDS=COPY                                                
 OUTFIL FNAMES=(SORTOUT),                                        
        BUILD=(1,7,                                              
               8,7,                                              
             /,1,6,C'-',                                        
               8,6,C'=',                                        
               1,6,UFF,SUB,8,6,UFF,EDIT=(TTTTTT),C' <--- ???!!!')  
 END                                                            
//*==============================================================
 

********************************* TOP OF DATA ******
085529 123456                                      
085529-123456=037927 - ???!!!                      
******************************** BOTTOM OF DATA ****
Javas and Pythons come and go, but JCL and SORT stay forever.

These users thanked the author sergeyken for the post:
golemis (Thu Dec 19, 2019 7:59 pm)
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times


Return to DFSORT/ICETOOL/ICEGENER