Page 1 of 1

Need Help on SORT jcl

PostPosted: Wed Apr 04, 2018 6:07 pm
by N J Baruah
Hi All,

I need a help from you to sort data from an input file based on the reference date present in it from column 55 to 62. My requirement is to sort out data which has been last referenced within 3 months.

Please note that the reference date is present in the format YY/DD/MM (e.g: 18/03/14 etc).

Can anyone please help me at the earliest ? Thanks in advance.

Re: Need Help on SORT jcl

PostPosted: Wed Apr 04, 2018 6:34 pm
by Robert Sample
Can anyone please help me at the earliest ?
Your first problem is that this is a volunteer forum -- as in, people respond if they have the time, the interest, and the subject knowledge to respond. Asking for urgent help is not likely to get you faster responses -- if the need is so urgent, convince your management to hire a consultant to help you.

Second, this is a HELP forum, not a WRITE-THE-CODE-FOR-YOU forum. Show us what you've coded, the results you got compared to what you expected to get, and we'll have suggestions to improve your code. But not showing us any code is usually a sign you're not going to see any code written for you.

Re: Need Help on SORT jcl

PostPosted: Wed Apr 04, 2018 6:53 pm
by N J Baruah
Thanks Robert for letting me know, will surely take care of it next time. Please find the screenshots attached.

Re: Need Help on SORT jcl

PostPosted: Wed Apr 04, 2018 7:26 pm
by enrico-sorichetti
do not post screen shots, they just waste space,

a text cut and paste from the 3270 emulator screen is more than enough.

Re: Need Help on SORT jcl

PostPosted: Wed Apr 04, 2018 9:46 pm
by NicC
Nohing to do with JCL but everything to do with Sort - for which there are 2 different sections in the forum depending on the sort product. Moving to DFSort but will move on to Syncsort if that is what you have (look at the messages).

Re: Need Help on SORT jcl

PostPosted: Thu Apr 05, 2018 9:34 pm
by N J Baruah
Hi All,

Can anyone please help me with this query ?
Your help will be really appreciated...

Thanks

Re: Need Help on SORT jcl

PostPosted: Thu Apr 05, 2018 11:10 pm
by enrico-sorichetti
soliciting for answers is considered bad netiquette
and it will usually make people ignore the topic

remember ...
we reply on our own time and free of charge

if nobody replies it means that
nobody has an in depth knowledge of the topic
nobody is interested in answering
nobody likes You :mrgreen:

Re: Need Help on SORT jcl

PostPosted: Mon Apr 09, 2018 6:32 pm
by N J Baruah
Hi,

I have tried some alternative for it as below using SYMNAMES:

//SYMNAMES DD  *
Cur_Date,S'&YR2./&MON./&DAY'
VALIDATE C'18/02/08'
/*
//SORTIN DD DSN=Input file
//SORTOUT DD DSN=Output file
//SYSIN DD *
  OPTION COPY
  INCLUDE COND=(55,8,CH,LE,Cur_Date,AND,55,8,CH,GT,VALIDATE)
/*
 


but instead of hard-coding the date "18/02/08" in the VALIDATE of SYMNAMES, I want to make it dynamic. I mean something like as below to sort out the data which has been last referenced within 3 months

//SYMNAMES DD  *
Cur_Date,S'&YR2./&MON./&DAY'
/*
//SORTIN DD DSN=Input file
//SORTOUT DD DSN=Output file
//SYSIN DD *
  OPTION COPY
  INCLUDE COND=(55,8,CH,LE,Cur_Date-90)
/*
 


but unfortunately this is not able to sort out the data which has been referenced within 3 months from the current date.
Can anyone please suggest what needs to be corrected to get the appropriate result as I am struggling with it .
Thanks in advance as this forum really helps us a lot in getting the appropriate results with the help of you guys and I am really in need of your help...

Re: Need Help on SORT jcl

PostPosted: Mon Apr 09, 2018 7:57 pm
by Robert Sample
Why don't you insert the century starting at position 55 (shifting the rest of the record 2 bytes to the right)? Then you have a DATE1 and you can then do a second SORT step to select the records based on the date being in the range you need. You could then strip out the inserted characters so the record length does not change.

Or you could copy the date at 55 to the end of the record, adding the century to make it a 10-byte DATE1, and proceed to use that date in your comparison, again stripping it off the record when you output your data.

You have plenty of ways to proceed, but you seem to have blinders on about how you have to accomplish your goal. And it may not be possible to accomplish the goal the way you want to do it. Until you are willing to look at alternatives, such as making two passes against the data set, you are shackling yourself.

You have posted three topics on this subject in less than a week. You insist the problem is urgent -- despite that this forum does not do urgent -- and yet you haven't been providing useful information. It is getting close to the time that all your topics on this subject will be locked, and any further new topics on the same topic will be locked as soon as possible.