Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SORT to add (replace) date in Julian format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
zh_lad

New User


Joined: 06 Jun 2009
Posts: 91
Location: UK

PostPosted: Mon May 12, 2014 2:25 pm    Post subject: SORT to add (replace) date in Julian format
Reply with quote

Hi,

I have a static file which I want to use daily. However, I want to change the date (julian format) to current date before I use it.

apart from other records, I have three records where I have date in julina formant and I want to change the date using sort.

----+----1----+----2----+----3----+----4
90Ðå48408514100 000014100N0300TEST00000
91 004840851410000000000000000000000000
92 004840851410000000000000000000000000

Date is on record type (column 1, length2, CHAR) 90, 91 and 92
File is FB and LRECL 170
above julian date is 14100 (YYDDD). It occurs twice on record type 90 (column 11 and 22) and once on record type 91 and 92, column 13.

I want to write a sort card to change this date to current system date.

Thanks,
zh_lad
Back to top
View user's profile Send private message

zh_lad

New User


Joined: 06 Jun 2009
Posts: 91
Location: UK

PostPosted: Mon May 12, 2014 2:42 pm    Post subject:
Reply with quote

It's a temporary fix to handle 'file not arriving' scenario. Will be taken off once sending system is ready.

Once I know the solution, I will try to get this date from a date file.

Hope I have answered your questions.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7240

PostPosted: Mon May 12, 2014 3:46 pm    Post subject: Reply to: SORT to add (replace) date in Julian format
Reply with quote

You missed the irony.

I think the generate-the-symbol approach is easiest, even for a once-off.

Have one step with SYSIN DD * and "SOMETHING, NOT RELEVANT" as the data.

OPTION COPY,STOPAFT=1
INREC to get julian date, and format it as a symbol on a symbol file.

Remember to create 80-byte records, so have 80:X at the end of your BUILD.

In your actual step, include DD for SYMNAMES which dataset from SORTOUT from above step, SYMNOUT DD so that you can see what is being used.

Then, on INREC, just identify each record, and OVERLAY the symbol's value in the appropriate place(s) for each record.

If it is a once-off, why not hard-code it, but that is another question....
Back to top
View user's profile Send private message
zh_lad

New User


Joined: 06 Jun 2009
Posts: 91
Location: UK

PostPosted: Mon May 12, 2014 4:45 pm    Post subject:
Reply with quote

I will come back to above solution. Mean while, I have used below sort card to extract current system date:

Input:
Code:
----+----1----+----2----+----3----+----4----+----5----+
*******************************************************
90Ðå48408514100  000014100N0300TEST00000000001000000000
91  004840851410000000000000000000000000000000000100000
92  004840851410000000000000000000000000000000000100000


SORT Card
Code:
OPTION COPY                               
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),   
             OVERLAY=(12:DATE1,22:DATE1)),
       IFTHEN=(WHEN=(1,2,CH,EQ,C'91'),   
             OVERLAY=(13:DATE1)),         
       IFTHEN=(WHEN=(1,2,CH,EQ,C'92'),   
             OVERLAY=(13:DATE1))         


Output:
Code:
----+----1----+----2----+----3----+----4----+----5----+
*******************************************************
90Ðå484085120140512002014051200TEST00000000001000000000
91  004840852014051200000000000000000000000000000100000
92  004840852014051200000000000000000000000000000100000


DATE1 is overlaying date in CCYYMMDD format. Is there a current date operand to overlay date in julian format?

I found something on Date Conversion line..
Code:
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),       
             OVERLAY=(12:DATE1,Y4T,TOJUL=Y4U))


But it does not work.

Many thanks.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7240

PostPosted: Mon May 12, 2014 5:06 pm    Post subject: Reply to: SORT to add (replace) date in Julian format
Reply with quote

Y4 means a four-digit year. Y2 means a two-digit year. Is that the only problem? "It does not work" is never very helpful if we don't know exactly how it didn't work for you. I'm sure that Y4U does work.
Back to top
View user's profile Send private message
zh_lad

New User


Joined: 06 Jun 2009
Posts: 91
Location: UK

PostPosted: Mon May 12, 2014 6:23 pm    Post subject:
Reply with quote

It was giving below error:
Code:
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12
            OPTION COPY                                       
            OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),             
                         OVERLAY=(12:DATE1,Y4T,TOJUL=Y4U))     
                                           £                   
ICE006A 0 OPERAND DEFINER ERROR                                 


I understand DATE1 is C'yyyymmdd' and Y4T is C'ccyymmdd', still it is giving Operand define error. Can you please advice? Thanks
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7240

PostPosted: Mon May 12, 2014 6:53 pm    Post subject: Reply to: SORT to add (replace) date in Julian format
Reply with quote

The Fine Manual wrote:
p,m,Y2x or p,m,Y4x
Specifies that an input date field is to be edited.


Now, is DATE1,Y4T of the format p,m,Y4T?

Code:
             OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),             
                         OVERLAY=(12:DATE1,
                                  12:12,8,TOJUL=Y4U))


Experiment along those lines.

You will lose a byte of your data, so extend your record temporarily to include DATE1 at the new location, then put it, converted, into column 12.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7240

PostPosted: Mon May 12, 2014 6:58 pm    Post subject: Reply to: SORT to add (replace) date in Julian format
Reply with quote

Perhaps you should look here and cut out the middleman, just using system symbols. Give it a whirl.
Back to top
View user's profile Send private message
zh_lad

New User


Joined: 06 Jun 2009
Posts: 91
Location: UK

PostPosted: Mon May 12, 2014 8:09 pm    Post subject:
Reply with quote

Thanks Bill. While you replied, worked on solution you suggested initially, using SYMNAMES. So far I had never used SYMNAMES, though I have seen people using it.

SYMNAMES is the easiest solution. Here is my JCL

Step one to extract julian date from calender file (pos 15, L 5)
Code:
//STEP001  EXEC PGM=SORT                                           
//SORTIN   DD DISP=SHR,DSN=my calendar file
//SORTOUT  DD DSN=my symbol file,                   
//            DISP=(,CATLG),SPACE=(TRK,(1,1))                     
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC BUILD=(C'MYDATE,''',15,5,C'''',80:X)                       
//SYSOUT   DD SYSOUT=*                                             
//SYSUDUMP DD SYSOUT=*                                             


and later using symbol MYDATE
Code:
//STEP002  EXEC PGM=SORT                               
//SYMNAMES DD DISP=SHR,DSN=my symbol file
//SORTIN   DD DISP=SHR,DSN=my input file
//*                                                   
//SORTOUT  DD DSN=output with edited julian date,
//            DISP=(,CATLG),SPACE=(TRK,(5,2))         
//SYSIN    DD *                                       
  OPTION COPY                                         
  OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),               
               OVERLAY=(11:MYDATE,22:MYDATE)),         
         IFTHEN=(WHEN=(1,2,CH,EQ,C'91'),               
               OVERLAY=(13:MYDATE)),                   
         IFTHEN=(WHEN=(1,2,CH,EQ,C'92'),               
               OVERLAY=(13:MYDATE))                   
//SYSOUT   DD SYSOUT=*                                 
//SYSUDUMP DD SYSOUT=*                                 


It worked well!

Thanks.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us