IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

[Solved]Automation need help in sorting the data


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3075
Location: NYC,USA

PostPosted: Sun Oct 22, 2023 1:14 pm
Reply with quote

I suggest to avoid posting back and forth the intermediate updates so give a try end to end with solution provided and if you are stuck anywhere then only post the that part what’s not working that way there is no or less confusion.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1307
Location: Bamberg, Germany

PostPosted: Sun Oct 22, 2023 5:58 pm
Reply with quote

Basically the whole thing is inconsequent. What if VIRTDATE matches only HEADER or TRAILER, and not both? Is this still a valid match or a diff? Should VIRTDATE assumed to be HEADER and TRAILER value and so on.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 145
Location: India

PostPosted: Wed Oct 25, 2023 4:07 pm
Reply with quote

Hi Pedro /Hello everyone, now I am stuck at one point while doing sorting. Have done the formatting now both file has same date format.

I have a file now which only has date record that i have extracted somehow from a huge file.

Now my File1 looks like below: which contains date to be compared.

Code:
 Command ===>               
 =COLS> ----+----1----+----2
 ****** ********************
 000001 VIRTDATE=2024-09-23


date position is 15 to 19th

and File 2:
Code:
 Command ===>                     
 =COLS> ----+----1----+----2----+-
 ****** **************************
 000001 HEADER2024-07-24         
 000002 TRAILER2024-07-24000101869


I want to check whether date in file 2 is correct or not it is not matching it should create an empty file if matching it should create a file having matching data.

please note in file2 record one has the date position is from 7th to 12th position and in record2 the date field position is form 8th to 13th. The whole idea is to just check whether the header and trailer date are correct if not correct need to send mail to a team.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 145
Location: India

PostPosted: Wed Oct 25, 2023 8:17 pm
Reply with quote

To make it more easy I removed the extra strings here now file1 looks like:

Code:
File1:
 Command ===>                 
 =COLS> ----+----1----+----2--
 ****** **********************
 000001 2024-09-23           
 ****** **********************


And File2:

Code:
 Command ===>                     
 ****** **************************
 000001 2024-09-23               
 000002 2024-07-24000101869       

****** **************************

Now both file date has same format, and they are in same position 1 to 10th inclusive. I need bit help here to validate the date in file 2 in both recorded whether in both record the date is matching with file 1 date if not correct create a empty file so that basis on this i can take further decision job es explained above i need to send mail to team saying that date is not matching. I feel i am close if anyone could give hint here.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 724
Location: Denmark

PostPosted: Wed Oct 25, 2023 9:01 pm
Reply with quote

Are you looking for a SORT solution, or is that still open?
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 145
Location: India

PostPosted: Wed Oct 25, 2023 9:14 pm
Reply with quote

Yes , I am looking for a sort solution here.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2119
Location: USA

PostPosted: Wed Oct 25, 2023 11:14 pm
Reply with quote

Code:
//SORT     EXEC PGM=SORT,PARM='RC16=NORC16'                       
//*                                                               
//* RC=0    - when both HEADER and TRAILER are equal to VIRTDATE                                                               
//* RC=4    - when only one of HEADER or TRAILER is equal to VIRTDATE
//* RC=16   - when neither HEADER, nor TRAILER is equal to VIRTDATE                                                               
//*                                                               
//SYSOUT   DD  SYSOUT=*                                           
//SORTIN   DD  *                                                   
VIRTDATE=2024-07-27                                               
. . . . . . . any garbage . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . any garbage . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . any garbage . . . . . . . . . . . . . . . . . . . . . . .
//*                                                               
//SORTHEAD DD  *                                                   
HEADER2024-07-27                                                   
. . . . . . . any garbage . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . any garbage . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . any garbage . . . . . . . . . . . . . . . . . . . . . . .
TRAILER2024-07-27                                                 
//*                                                               
//MATCH0   DD  SYSOUT=*                                           
//MATCH1   DD  SYSOUT=*                                           
//MATCH2   DD  SYSOUT=*                                           
//*                                                               
//SYSIN    DD  *                                                   
 JOINKEYS F1=SORTIN,                                               
          INCLUDE=(1,9,CH,EQ,C'VIRTDATE='),                       
          FIELDS=(10,10,A)                                         
 JOINKEYS F2=SORTHEAD,                                             
          FIELDS=(10,10,A)                       
 JOIN UNPAIRED,F1,F2                             
                                                 
 REFORMAT FIELDS=(F1:1,80,                       
                  F2:1,80,?)                     
                                                 
 INREC IFTHEN=(WHEN=INIT,                         
               OVERLAY=(162:C'0')),               
       IFTHEN=(WHEN=(161,1,CH,EQ,C'B'),           
               OVERLAY=(162:SEQNUM,1,ZD))         
                                                 
 SORT FIELDS=COPY                                 
                                                 
 OUTFIL FNAMES=(MATCH2),                         
        NULLOFL=RC4,                             
        INCLUDE=(162,1,CH,EQ,C'2')               
 OUTFIL FNAMES=(MATCH1),                         
        NULLOFL=RC16,                             
        INCLUDE=(162,1,CH,EQ,C'1')               
 OUTFIL FNAMES=(MATCH0),                         
        SAVE                                     
 END                                             
//*                                               
//JNF2CNTL DD  *                                 
 INCLUDE COND=(1,6,CH,EQ,C'HEADER',               
            OR,1,7,CH,EQ,C'TRAILER')               
 INREC IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),         
               BUILD=(1:1,6,                       
                     10:7,10)),                     
       IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),         
               BUILD=(1:1,7,                       
                     10:8,10))                     
//*                                                 
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 145
Location: India

PostPosted: Thu Oct 26, 2023 11:39 am
Reply with quote

above code i tried and it is getting abended.

Code:
SORTEX05 0006919 S        U0016   THU 26 OCT 2023.299 02:05


my both file length is 2003, first it was getting abended due to Parm error.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2119
Location: USA

PostPosted: Thu Oct 26, 2023 1:48 pm
Reply with quote

Digvijay Singh wrote:
above code i tried and it is getting abended.

Code:
SORTEX05 0006919 S        U0016   THU 26 OCT 2023.299 02:05


my both file length is 2003, first it was getting abended due to Parm error.

You need to use PARM='RC16=NORC16'
You also must present here the exact code, and the exact results you've got.
Where is your sample of code?
Where is your log of execution?
Where are your input and any output data?
Do not forget to use the Code button when posting your code samples.
Otherwise there is nothing to talk about.
Try to understand this.

Please, try not only to copy-and-paste, but also to apply some thinking abilities.
Do not suppose that others would do your own job, free of charge.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2119
Location: USA

PostPosted: Thu Oct 26, 2023 2:43 pm
Reply with quote

One more free hint for you.

Unlike SYNCSORT, the IBM's DFSORT does not take PARM='RC16=NORC16'

Instead, you can use the specific statement DEBUG NOABEND
DEBUG control statement
Again: this is your own responsibility to find out such technical details.

I continue doing your own job, while you are only sending your requirements, in a hard-to-understand manner.
You resemble me a "big boss", who has no idea about any technical details, but only gives instructions like: "The grass must be painted green, starting from the fence, and ending by lunch"
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 145
Location: India

PostPosted: Thu Oct 26, 2023 3:02 pm
Reply with quote

Hello All,

I have solved my problem using below sort card.

Code:

//STEP0009 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG  DD SYSOUT=*                                           
//IN       DD DISP=SHR,DSN=TSYS.UTILITY.TICTOC.DATE7             
//         DD DISP=SHR,DSN=TSYS.UTILITY.TICTOC.DATE6             
//MATCHED  DD DSN=TSYS.UTILITY.TICTOC.MATCHED.DATE8,             
//             SPACE=(CYL,(1,1),RLSE),                           
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),               
//             DISP=(NEW,CATLG,DELETE)                           
//UNMATCH  DD DSN=TSYS.UTILITY.TICTOC.UNMATCH.DATE9,             
//             SPACE=(CYL,(1,1),RLSE),                           
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),               
//             DISP=(NEW,CATLG,DELETE)                           
//TOOLIN   DD *                                                 
SELECT FROM(IN) TO(MATCHED) ON(1,10,CH) ALLDUPS DISCARD(UNMATCH)

/*

IF the date is not matching my unmatched file has data and accordingly i am checking further in process. I am not bothered about matched file if unmatched file has data it means date is not matching.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 145
Location: India

PostPosted: Thu Oct 26, 2023 3:17 pm
Reply with quote

sergeyken wrote:
One more free hint for you.

Unlike SYNCSORT, the IBM's DFSORT does not take PARM='RC16=NORC16'

Instead, you can use the specific statement DEBUG NOABEND
DEBUG control statement
Again: this is your own responsibility to find out such technical details.

I continue doing your own job, while you are only sending your requirements, in a hard-to-understand manner.
You resemble me a "big boss", who has no idea about any technical details, but only gives instructions like: "The grass must be painted green, starting from the fence, and ending by lunch"


I have solved my all questions asked here by myself i guess, if you check the post completely, I extracted whole data from file and prepared a complete job myself and able to achieve this. few suggestions it helped me but i wrote my all code by myself.
I thank you for you all for having a look at my problem.
Thank you for your support and suggestions here.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 145
Location: India

PostPosted: Thu Oct 26, 2023 4:05 pm
Reply with quote

Would like to explain how i did it:

1st I extracted the date in one file which I need to compare the with file2.

2nd since the the format of the date in both file was different i reformatted the date in file1, now the date format is same in Both the the file.

3rd now i have
File1: having one record which is date
record01 2024-04-23
File2: having 2 record
record01 HEADER2024-04-23
record02 TRAILER2024-04-23

4TH i removed the header and trailer string from both the record and compare the date from file1 to date in file2 if it is not matching with any of the record in file2 it creates in unmatched file by checking the data in unmatched data set i proceed further in my job.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3075
Location: NYC,USA

PostPosted: Thu Oct 26, 2023 5:32 pm
Reply with quote

There is a great scope of optimization here as many steps can be squeezed into one but it’s fine .

I am locking the topic to avoid further back and forth and marking it as it’s solved.

Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL Goto page Previous  1, 2

 


Similar Topics
Topic Forum Replies
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts External data queue (changes?) CLIST & REXX 0
No new posts Pull data using date difference betwe... DB2 6
No new posts fast data scrambling PL/I & Assembler 10
No new posts Need help In Mainframe Automation AF/... CLIST & REXX 14
Search our Forums:

Back to Top