MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Convert Julian date to a new format

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Fri Oct 20, 2017 2:11 pm    Post subject: Convert Julian date to a new format Reply with quote

I have report which shows as below

Code:

D17246  T193102 WEEKLY      1   2   3   TESTING
           17-OCT-2017


I want to have the new report which should look like as below

Code:

D17246    T193102    WEEKLY      1   2   3   17OCT2017
03SEP2017 19:31:02    COMMENTS: TESTING_______________________


Basically coverting Julian date to the new date format , Time to be in HH:MM:SS format and date formatting to remove two hyphens - and adding up
COMMENTS label with the contents upto 30 bytes and filling up with _ till the end of the length.

After the actual coments TESTING it should padd with spaces filling length of 30 bytes , so total comments field should be of max 30 bytes

Another question with related to this:

Let us say I have ISPF Menu and I use option say 7 to get customized report as of now. The report which gets displayed is also saved in dataset USERID.REPORT.
Basically what is displayed on the screen is the output of the dataset.

Now I want the report in a new format way , so when I choose option 7 . So how can I do that . Should I be aware of the source of REXX panel / CLIST which
actually kicks off to show the report. I mean it should show up new report let us say USER.REPORT.FORMAT instead of USERID.REPORT or same USERID.REPORT if it is formatted.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Sun Oct 22, 2017 3:02 pm    Post subject: Re: Convert Julian date to a new format Reply with quote

shekar123 wrote:


Basically coverting Julian date to the new date format , Time to be in HH:MM:SS format and date formatting to remove two hyphens - and adding up
COMMENTS label with the contents upto 30 bytes and filling up with _ till the end of the length.

After the actual coments TESTING it should padd with spaces filling length of 30 bytes , so total comments field should be of max 30 bytes



Sekhar123,

This is quite easy.

1. Number the records using SEQNUM
2. Using WHEN=GROUP, push the 1st record on to 2nd record at the end by checking the seqnum of 1 that you added in step 1 with records=2
3. Now convert the julian date using TOGREG function and output in Y4w format for the 2nd record.
4. Using OUTFIL startrec=2, eliminate the 1st record and build the 1 and 2nd records using the contents you pushed at the end and for the month name, use CHANGE command to convert the 2 digit monthly name 3 character month name.




shekar123 wrote:


Another question with related to this:

Let us say I have ISPF Menu and I use option say 7 to get customized report as of now. The report which gets displayed is also saved in dataset USERID.REPORT.
Basically what is displayed on the screen is the output of the dataset.

Now I want the report in a new format way , so when I choose option 7 . So how can I do that . Should I be aware of the source of REXX panel / CLIST which
actually kicks off to show the report. I mean it should show up new report let us say USER.REPORT.FORMAT instead of USERID.REPORT or same USERID.REPORT if it is formatted.


You need to Write your OWN rexx/clist to format the dataset to your needs and invoke it AFTER you generated the report from your customized option 7.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Oct 23, 2017 7:57 am    Post subject: Reply with quote

Thanks Kolusu for your inputs . This helps me out.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Tue Oct 24, 2017 11:05 am    Post subject: Reply with quote

Kolusu,

I tried by the below way and I am stuck up
Code:
//STEP010  EXEC PGM=SORT                                               
//SORTIN   DD *                                                         
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
D17246  T193102 WEEKLY      1   2   3   TESTING                         
 Â               17-OCT-2017                                             
/*                                                                     
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC OVERLAY=(1,80,81:SEQNUM,1,ZD)                                   
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:SEQNUM=2)),               
  OUTFIL INCLUDE=(81,1,ZD,EQ,1),                                       
  BUILD=(1:1,40,/,17:C'COMMENTS: ',27:98,11)                           
/*                                                                     
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD SYSOUT=*                                                 
//                                                                     

ICE002I 0 DUPLICATE OR CONFLICTING INREC    STATEMENT                           
ICE002I 0 DUPLICATE OR CONFLICTING INREC    STATEMENT                           
ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE805I 1 JOBNAME: KC03F89R , STEPNAME: STEP010                                 
ICE802I 0 BLOCKSET     TECHNIQUE IN CONTROL                                     
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE 
ICE000I 1 - CONTROL STATEMENTS FOR 5650-ZOS, Z/OS DFSORT V2R1  - 11:58 ON TUE OCT 24, 2017 -
            SORT FIELDS=COPY                                                   
            INREC OVERLAY=(1,80,81:SEQNUM,1,ZD)                                 
            INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:SEQNUM=2)),             
            INREC IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,1),PUSH=(82:17,11)),     
            OUTFIL INCLUDE=(81,1,ZD,EQ,1),                                     
            BUILD=(1:1,40,41:97,11,/,17:C'COMMENTS: ',27:41,30)                 
ICE027A 9 END OF SORTOUT  FIELD BEYOND MAXIMUM RECORD LENGTH                   
ICE751I 0 C5-BASE   C6-BASE   C7-K96411 C8-K96411 E9-BASE   E7-K96411           
ICE052I 3 END OF DFSORT                                                         

I am trying to add 1st record and then the 2nd record in one line and then trying to create first 40 bytes in line 1 and then in line 2 building up the COMMENTS and the text
Can you please help me further.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Oct 24, 2017 3:07 pm    Post subject: Reply with quote

shekar123,


Try these untested control cards

Code:


//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=INIT,                                         
       OVERLAY=(81:SEQNUM,8,ZD)),                                 
        IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),                   
                PUSH=(101:1,80),RECORDS=2),                       
        IFTHEN=(WHEN=(81,8,ZD,EQ,2),                               
       OVERLAY=(90:102,5,Y2T,TOGREG=Y4W))                         
                                                                   
  OUTFIL STARTREC=2,IFOUTLEN=80,                                   
  IFTHEN=(WHEN=(81,8,ZD,EQ,2),                                     
   BUILD=(101,40,                                                 
          012,02,                                                 
          015,03,                                                 
          019,04,/,                                               
          092,02,                                                 
          090,2,CHANGE=(3,C'01',C'JAN',C'02',C'FEB',C'03',C'MAR', 
                         C'04',C'APR',C'05',C'MAY',C'06',C'JUN',   
                         C'07',C'JUL',C'08',C'AUG',C'09',C'SEP',   
                         C'10',C'OCT',C'11',C'NOV',C'12',C'DEC'), 
                         NOMATCH(C'ERR'),                         
          94,4,                                                   
          X,                                                       
          110,2,                                                   
          C':',                                                   
          112,2,                                                   
          C':',                                                   
          114,2,                                                   
          4X,                                                     
          C'COMMENTS: TESTING',                                   
          30C'_'))                                                 
//*                                                               

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Oct 25, 2017 7:30 am    Post subject: Reply with quote

Kolusu,

Please see my input and the output which I have got when I have multiple records
Code:

//**********************************************************************
//STEP010  EXEC PGM=SORT                                               
//SORTIN   DD *                                                         
D17246  T193102 WEEKLY      1   2   3   TESTING1                       
 Â               17-OCT-2017                                             
D17247  T093102 MONTHLY     4   5   6   TESTING2                       
 Â               18-OCT-2017                                             
/*                                                                     
//SYSIN    DD *                                                        
  OPTION COPY                                                          
  INREC IFTHEN=(WHEN=INIT,                                             
       OVERLAY=(81:SEQNUM,8,ZD)),                                      
        IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),                       
                PUSH=(101:1,80),RECORDS=2),                             
        IFTHEN=(WHEN=(81,8,ZD,EQ,2),                                   
       OVERLAY=(90:102,5,Y2T,TOGREG=Y4W))                               
                                                                       
  OUTFIL STARTREC=2,IFOUTLEN=80,                                       
  IFTHEN=(WHEN=(81,8,ZD,EQ,2),                                          
   BUILD=(101,40,                                                       
          012,02,                                                      
          015,03,                                                      
          019,04,/,                                                    
          092,02,                                                      
          090,2,CHANGE=(3,C'01',C'JAN',C'02',C'FEB',C'03',C'MAR',       
                         C'04',C'APR',C'05',C'MAY',C'06',C'JUN',       
                         C'07',C'JUL',C'08',C'AUG',C'09',C'SEP',       
                         C'10',C'OCT',C'11',C'NOV',C'12',C'DEC'),       
                         NOMATCH(C'ERR'),                               
          94,4,                                                         
          X,                                                           
          110,2,                                                       
          C':',                                                         
          112,2,                                                       
          C':',                                                         
          114,2,                                                       
          4X,                             
          C'COMMENTS: TESTING',           
          30C'_'))                         
/*                                         
//SYSPRINT DD SYSOUT=*                     
//SYSOUT   DD SYSOUT=*                     
//SORTOUT  DD SYSOUT=*                     
//                                   

Output
Code:

D17246  T193102 WEEKLY      1   2   3       1-OCT                               
03SEP2017 19:31:02    COMMENTS: TESTING______________________________           
D17247  T093102 MONTHLY     4   5   6   TESTING2                               
                18-OCT-2017                                                     

I am not achieving desired results , can you please help here.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Oct 25, 2017 11:24 am    Post subject: Reply with quote

shekar123 wrote:
Kolusu,

Please see my input and the output which I have got when I have multiple records
I am not achieving desired results , can you please help here.


Shekar123,

How hard is to explain the requirements in 1 go? You could have mentioned in the first post about having multiple header records which start with D at position 1 and you want write 2 records from it. You did not even bother to explain even after I gave you the hint about eliminating the first record and starting with record number 2 and now you come back to tell me that you have multiple headers. Sigh

It is really difficult to produce a solution with a moving target requirements. Anyway here is another set of untested control cards.

Code:

//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'D'),                 
                PUSH=(101:1,80),RECORDS=2),                       
        IFTHEN=(WHEN=(101,1,CH,EQ,C'D'),                           
       OVERLAY=(90:102,5,Y2T,TOGREG=Y4W))                         
                                                                   
  OUTFIL OMIT=(1,1,CH,EQ,C'D'),IFOUTLEN=80,                       
  IFTHEN=(WHEN=(101,1,CH,EQ,C'D'),                                 
   BUILD=(101,40,                                                 
          017,02,                                                 
          020,03,                                                 
          024,04,/,                                               
          092,02,                                                 
          090,2,CHANGE=(3,C'01',C'JAN',C'02',C'FEB',C'03',C'MAR', 
                         C'04',C'APR',C'05',C'MAY',C'06',C'JUN',   
                         C'07',C'JUL',C'08',C'AUG',C'09',C'SEP',   
                         C'10',C'OCT',C'11',C'NOV',C'12',C'DEC'), 
                         NOMATCH(C'ERR'),                         
          94,4,                                                   
          X,                                                       
          110,2,                                                   
          C':',                                                   
          112,2,                                                   
          C':',                                                   
          114,2,                                                   
          4X,                                                     
          C'COMMENTS: TESTING',                                   
          30C'_'))                                                 
//*                                                               

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Oct 25, 2017 1:38 pm    Post subject: Reply with quote

Kolusu,

First of all thanks for your help and I really apologize that I was not clear. I was in the assumption that the solution will work with those kind of records. I should have been clear on the same. This will not repeat again. I have run the code and here are my results:
Code:

D17246  T193102 WEEKLY      1   2   3   17OCT2017                               
03SEP2017 19:31:02    COMMENTS: TESTING______________________________           
D17247  T093102 MONTHLY     4   5   6   18OCT2017                               
04SEP2017 09:31:02    COMMENTS: TESTING______________________________           

I will have to tailor the positions to align as below:
Code:

D17246    T193102  WEEKLY      1   2   3   17OCT2017                   
03SEP2017 19:31:02 COMMENTS: TEST1________________________________     
D17247    T093102  MONTHLY     4   5   6   18OCT2017                   
04SEP2017 09:31:02 COMMENTS: TESTING2_____________________________     

If the first record had TEST1 and second record had TESTING2 as the contents they should have TEST1 followed by _ to fill in 30 max length and the same for TESTING2 followed by _ to fill in 30 max length after the hardcoded label COMMENTS:

I should have been more clear in my initial post . Sorry for the same.

Thank you once again for your help.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Oct 25, 2017 2:45 pm    Post subject: Reply with quote

shekar123 wrote:


I will have to tailor the positions to align as below:
Code:

D17246    T193102  WEEKLY      1   2   3   17OCT2017                   
03SEP2017 19:31:02 COMMENTS: TEST1________________________________     
D17247    T093102  MONTHLY     4   5   6   18OCT2017                   
04SEP2017 09:31:02 COMMENTS: TESTING2_____________________________     



Shekar123,

Did you even bother to understand what the job is doing? If you did aligning is such a simple task. Clue look at what 101,40 is doing and split that into multiple fileds. And for the 4 spaces before comment understand what 4x does.

shekar123 wrote:


If first record had TEST1 and second record had TESTING2 as the contents they should have TEST1 followed by _ to fill in 30 max length and the same for TESTING2 followed by _ to fill in 30 max length after the hardcoded label COMMENTS:

I should have been more clear in my initial post . Sorry for the same.

Thank you once again for your help.



Shekar123,

Yet another requirement change. SMH. What happens if you have testing 3 and 4? Or any other testing n? Either way it is trivial to add the updated text message

Look up the earlier CHANGE command and follow the same pattern.


Please do NOT expect to be spoon fed with solutions despite being an experienced programmer.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Oct 26, 2017 6:21 am    Post subject: Reply with quote

Kolusu,

I tailored code changes as suggested by you and I was able to get the desired results.

Input records
Code:

D17246  T193102 WEEKLY      1   2   3   TEST1         
 Â               17-OCT-2017                           
D17247  T093102 MONTHLY     4   5   6   TESTING2       
 Â               18-OCT-2017                           
       
Output records
Code:

D17246    T193102     WEEKLY      1   2   3 17OCT2017                           
03SEP2017 19:31:02    COMMENTS:   TEST1                                         
                                                                               
D17247    T093102     MONTHLY     4   5   6 18OCT2017                           
04SEP2017 09:31:02    COMMENTS:   TESTING2                                     

Changed code
Code:

  OPTION COPY                                                          
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'D'),                     
                PUSH=(101:1,80),RECORDS=2),                            
        IFTHEN=(WHEN=(101,1,CH,EQ,C'D'),                               
       OVERLAY=(90:102,5,Y2T,TOGREG=Y4W))                              
                                                                       
  OUTFIL OMIT=(1,1,CH,EQ,C'D'),IFOUTLEN=80,                            
  IFTHEN=(WHEN=(101,1,CH,EQ,C'D'),                                     
  BUILD=(001:101,8,                                                    
         009:C'  ',                                                    
         011:109,7,                                                    
         018:C'    ',                                                  
         022:116,10,                                                   
         032:126,13,                                                   
         017,02,                                                       
         020,03,                                                       
         024,04,/,                                                     
         092,02,                                                       
         090,2,CHANGE=(3,C'01',C'JAN',C'02',C'FEB',C'03',C'MAR',       
                         C'04',C'APR',C'05',C'MAY',C'06',C'JUN',       
                         C'07',C'JUL',C'08',C'AUG',C'09',C'SEP',       
                         C'10',C'OCT',C'11',C'NOV',C'12',C'DEC'),      
                         NOMATCH(C'ERR'),                              
         094,4,                                                        
         X,                                                            
         110,2,                                                        
         C':',                                                         
         112,2,                                                        
         C':',                                                         
         114,2,                                                        
         4X,                                                           
         C'COMMENTS: ',                                                
         33:139,35,/))                                                 

Thank you once again for all your help.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Oct 26, 2017 12:46 pm    Post subject: Reply with quote

shekar123 wrote:
Kolusu,

I tailored code changes as suggested by you and I was able to get the desired results.
Thank you once again for all your help.


what happened the testing 1 and testing 2 change? You simply changed the input?

It is such a simple change and you circumvented the problem by changing the input.

Code:

//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'D'),                 
                PUSH=(101:1,80),RECORDS=2),                       
        IFTHEN=(WHEN=(101,1,CH,EQ,C'D'),                           
       OVERLAY=(90:102,5,Y2T,TOGREG=Y4W))                         
                                                                   
  OUTFIL OMIT=(1,1,CH,EQ,C'D'),IFOUTLEN=80,                       
  IFTHEN=(WHEN=(101,1,CH,EQ,C'D'),                                 
   BUILD=(101,06,                                                 
          4X,                                                     
          109,07,                                                 
          4X,                                                     
          117,10,                                                 
          129,10,                                                 
          017,02,                                                 
          020,03,                                                 
          024,04,/,                                               
          092,02,                                                 
          090,2,CHANGE=(3,C'01',C'JAN',C'02',C'FEB',C'03',C'MAR', 
                         C'04',C'APR',C'05',C'MAY',C'06',C'JUN',   
                         C'07',C'JUL',C'08',C'AUG',C'09',C'SEP',   
                         C'10',C'OCT',C'11',C'NOV',C'12',C'DEC'), 
                         NOMATCH(C'ERR'),                         
          94,4,                                                   
          X,                                                       
          110,2,                                                   
          C':',                                                   
          112,2,                                                   
          C':',                                                   
          114,2,                                                   
          3X,                                                     
          C'COMMENTS: ',                                           
          141,9,CHANGE=(9,C'TESTING1',C'TEST1____')   
                        NOMATCH=(141,9),                           
          21C'_'))                                                 
//*                                                               

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Sat Oct 28, 2017 12:21 am    Post subject: Reply with quote

Thanks Kolusu for helping me further. I was not able to make use of _ in my code while testing for the TESTING1 and TESTING2 , so my output I made them not to use _

With your code I am able to achieve desired results.

Thank you once again.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group