Page 2 of 2

Re: Convert Local TSD in UTC

PostPosted: Tue Jan 18, 2011 1:41 am
by spini
great..Thanks a lot!!
Only one question. The offset could be positive too.How can I hadle this case? Should I use IFTHEN to verify the sign ?
Regards

Re: Convert Local TSD in UTC

PostPosted: Tue Jan 18, 2011 3:43 am
by skolusu
spini,

If the offset can have a sign then you use the following control cards.

//SYSIN    DD *                                                       
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(275:47,1,SFF,ZD,LENGTH=1)),       
  IFTHEN=(WHEN=INIT,                                                 
  FINDREP=(STARTPOS=275,INOUT=(X'F0',X'1D',X'D0',X'1C'))),           
  IFTHEN=(WHEN=INIT,                                                 
  OVERLAY=(276:(35,2,ZD,MUL,+3600,ADD,38,2,ZD,MUL,+0060,ADD,41,2,ZD),
           SUB,((48,2,ZD,MUL,+3600,ADD,51,2,ZD,MUL,+60),MUL,275,1,PD),
           ZD,LENGTH=8)),                                             
  IFTHEN=(WHEN=(276,8,ZD,LE,0),                                       
  OVERLAY=(276:276,8,ZD,ADD,+86400,ZD,LENGTH=8,                       
           284:24,10,UFF,M11,LENGTH=8,                               
           024:284,8,Y4T,SUBDAYS,+1,TOGREG=Y4T(-)))                   
                                                                     
  OUTREC IFOUTLEN=274,IFTHEN=(WHEN=INIT,                             
  OVERLAY=(35:276,8,ZD,DIV,+3600,EDIT=(TT),                           
           38:(276,8,ZD,MOD,+3600),DIV,+60,EDIT=(TT),                 
           41:((276,8,ZD,MOD,+3600),MOD,+60),EDIT=(TT)))             
//*

Re: Convert Local TSD in UTC

PostPosted: Tue Jan 18, 2011 12:46 pm
by spini
Hi Skolusu,

I am impressed..;-).
But the DFSORT has some problem with the function SUBDAYS.

BLOCKSET COPY TECHNIQUE SELECTED
VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
- CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 07:48 ON TUE JAN 18, 201
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(275:52,1,SFF,ZD,LENGTH=1)),
IFTHEN=(WHEN=INIT,
FINDREP=(STARTPOS=275,INOUT=(X'F0',X'1D',X'D0',X'1C'))),
IFTHEN=(WHEN=INIT,
OVERLAY=(276:(40,2,ZD,MUL,+3600,ADD,43,2,ZD,MUL,+0060,ADD,47,2,ZD),
SUB,((53,2,ZD,MUL,+3600,ADD,55,2,ZD,MUL,+60),MUL,275,1,PD),
ZD,LENGTH=8)),
IFTHEN=(WHEN=(276,8,ZD,LE,0),
OVERLAY=(276:276,8,ZD,ADD,+86400,ZD,LENGTH=8,
284:24,10,UFF,M11,LENGTH=8,
024:284,8,Y4T,SUBDAYS,+1,TOGREG=Y4T(-)))
$
SYNTAX ERROR
OUTREC IFOUTLEN=274,IFTHEN=(WHEN=INIT,
OVERLAY=(40:276,8,ZD,DIV,+3600,EDIT=(TT),
43:(276,8,ZD,MOD,+3600),DIV,+60,EDIT=(TT),
47:((276,8,ZD,MOD,+3600),MOD,+60),EDIT=(TT)))
C5-K51707 C6-K51707 C7-K54603 C8-K51707 E7-K51707
END OF DFSORT
******************************* BOTTOM OF DATA ********************************

I iligned the positions from the sort,too

11-01-11T11:03:14.123-01:30
Pos.29-38 2011-01-11
Pos.39 T
Pos.40-51 11:03:14.123
Pos.52 sign (-)
Pos.53-57 01:30 (offset)

For what is FINDREP needed ?

Regards

Re: Convert Local TSD in UTC

PostPosted: Tue Jan 18, 2011 11:44 pm
by skolusu
I am impressed..;-).
But the DFSORT has some problem with the function SUBDAYS.


Thank you. DFSORT does not have a problem with SUBDAYS function. It is the version of DFSORT on your system that you are running. Looks like your System does NOT have the PTF H which supports date arithmetic. Your last sysout chopped off the message code. The message ICE201I in the SYSOUT should have H next to it to support the date arithmetic function. Ask your System Programmer to install it (it's free).

In your sysout if you see

ICE201I H RECORD TYPE ...

the H indicates you have the October, 2010 DFSORT functions (RESIZE, IFTRAIL, ACCEPT, ADDDAYS, DATEDIFF, TRAN=ATOE, KEYBEGIN, etc) and all of the earlier functions. This function level corresponds to z/OS DFSORT V1R10 PTF UK90025 and z/OS DFSORT V1R12 PTF UK90026. You are completely up to date on DFSORT functional PTFs.

If you see:

ICE201I G RECORD TYPE ...

the G indicates you have the November, 2009 DFSORT functions (JOINKEYS, TOJUL, TOGREG, WEEKDAY, etc) and all of the earlier functions. This function level corresponds to z/OS DFSORT V1R5 PTF UK51706 and z/OS DFSORT V1R10 PTF UK51707. You are behind on DFSORT functional PTFs. Ask your System Programmer to install z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026.

If you see:

ICE201I F RECORD TYPE ... then you need to code a program.

For what is FINDREP needed ?


I translated the positive(+) to -1 in Packed decimal format and negative (-) to +1 in packed decimal format using findrep.

I ailigned the positions from the sort,too

11-01-11T11:03:14.123-01:30
Pos.29-38 2011-01-11
Pos.39 T
Pos.40-51 11:03:14.123
Pos.52 sign (-)
Pos.53-57 01:30 (offset)


*Sigh* It is really difficult to provide solutions with moving target. within a span of 5 posts the positions of the date fields crawled 5 bytes more?

Also I realized that with positive offsets , the date needs to incremented in case the calculated seconds exceeds 86399 (24 hours = 86400 seconds)

Use the following DFSORT control cards which will give you the desired results.

//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(275:52,1,SFF,ZD,LENGTH=1)),         
  IFTHEN=(WHEN=INIT,                                                   
  FINDREP=(STARTPOS=275,INOUT=(X'F0',X'1D',X'D0',X'1C'))),             
  IFTHEN=(WHEN=INIT,                                                   
  OVERLAY=(276:(40,2,ZD,MUL,+3600,ADD,43,2,ZD,MUL,+60,ADD,46,2,ZD),     
           SUB,((53,2,ZD,MUL,+3600,ADD,56,2,ZD,MUL,+60),MUL,275,1,PD), 
           ZD,LENGTH=8)),                                               
  IFTHEN=(WHEN=(276,8,ZD,LE,0),                                         
  OVERLAY=(276:276,8,ZD,ADD,+86400,ZD,LENGTH=8,                         
           284:29,10,UFF,M11,LENGTH=8,                                 
           292:284,8,Y4T,TOJUL=Y4T,                                     
           296:296,3,ZD,SUB,+1,EDIT=(TTT),C'P'),HIT=NEXT),             
                                                                       
                                                                       
  IFTHEN=(WHEN=(299,1,CH,EQ,C'P',AND,296,3,ZD,GT,0),                   
  OVERLAY=(029:292,7,Y4T,TOGREG=Y4T(-))),                               
                                                                       
  IFTHEN=(WHEN=(299,1,CH,EQ,C'P',AND,34,5,CH,EQ,C'01-01'),             
  OVERLAY=(029:292,4,ZD,SUB,+1,EDIT=(TTTT),C'-12-31')),                 
                                                                       
  IFTHEN=(WHEN=(276,8,ZD,GT,86399),                                     
  OVERLAY=(276:276,8,ZD,SUB,+86400,ZD,LENGTH=8,                         
           284:29,10,UFF,M11,LENGTH=8,                                 
           292:284,8,Y4T,TOJUL=Y4T,                                     
           296:296,3,ZD,ADD,+1,EDIT=(TTT),C'N'),HIT=NEXT),             
                                                                       
  IFTHEN=(WHEN=(299,1,CH,EQ,C'N',AND,34,5,CH,EQ,C'12-31'),             
  OVERLAY=(029:292,4,ZD,ADD,+1,EDIT=(TTTT),C'-01-01',299:C' ')),       
                                                                       
  IFTHEN=(WHEN=(299,1,CH,EQ,C'N',AND,34,5,CH,NE,C'12-31'),             
  OVERLAY=(029:292,7,Y4T,TOGREG=Y4T(-)))                               
                                                                       
  OUTREC IFOUTLEN=274,IFTHEN=(WHEN=INIT,                               
  OVERLAY=(40:276,8,ZD,DIV,+3600,EDIT=(TT),                             
           43:(276,8,ZD,MOD,+3600),DIV,+60,EDIT=(TT),                   
           46:((276,8,ZD,MOD,+3600),MOD,+60),EDIT=(TT)))               
//*

Re: Convert Local TSD in UTC

PostPosted: Wed Jan 19, 2011 2:09 pm
by spini
Hi Skolusu,

i am still impressed, but did you said 'The logic is quite simple'.. ;-)
But it works now well. I love Dfsort :-)

Again, thanks a lot for you help.
Regards
Spini