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

DFSORT GUID


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pinakimishra

New User


Joined: 21 Jul 2007
Posts: 24
Location: phoenix

PostPosted: Wed May 08, 2024 1:05 am
Reply with quote

Is there a way I can generate GUID using DFSORT? If not then can it be done using COBOL Program. Will prefer DFSORT if it ca be done by it.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed May 08, 2024 6:13 am
Reply with quote

See also https://stackoverflow.com/questions/25703620/auto-generation-of-a-unique-id-using-cobol
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2029
Location: USA

PostPosted: Wed May 08, 2024 9:56 pm
Reply with quote

pinakimishra wrote:
Is there a way I can generate GUID using DFSORT? If not then can it be done using COBOL Program. Will prefer DFSORT if it ca be done by it.

Try to use the values of &DATE5, and SEQNUM, and various combinations of operations with those values.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2029
Location: USA

PostPosted: Thu May 09, 2024 11:48 pm
Reply with quote

Just for fun: one of multiple ways to do this
Code:
//*=====================================================================
//UIDFINAL EXEC PGM=SORT                                               
//SYSOUT   DD  SYSOUT=*                                                 
//SORTIN   DD  *                                                       
TRANSACTION 00                                                         
TRANSACTION 01                                                         
TRANSACTION 02                                                         
TRANSACTION 03                                                         
TRANSACTION 04                                                         
TRANSACTION 05                                                         
TRANSACTION 06                                                         
TRANSACTION 07                                                         
TRANSACTION 08                                                         
TRANSACTION 10                                                         
//*                                                                     
//SORTOUTF DD  DISP=(NEW,CATLG),SPACE=(TRK,(5,5)),                     
//             DSN=&SYSUID..GUID.TEXT                                   
//SORTOUT  DD  SYSOUT=*                                                 
//*                                                                     
//SYMNAMES DD  *                                                       
GUID,30,36,CH                                                           
SourceRec,1,80                                                         
SeqNum,*,4,BI                                                           
*                                                                       
DateTime5,*,26,CH                                                       
* 2024-05-09-11.07.29.820675       
*   |<---L9---->||<--R9--->|       
Date5,=,10,CH                       
SKIP,1                             
Time5,*,8,CH                       
SKIP,1                             
Time5Ms,*,6,ZD                     
POSITION,DateTime5                 
SKIP,2                             
NumsLeft9,*,13,UFF                 
NumsRight9,*,11,UFF                 
*                                   
Code1,*,4,BI                       
Code2,*,4,BI                       
Code3,*,4,BI                       
Code4,*,4,BI                       
*                                   
POSITION,Code1                     
BinGUID1,*,4,BI                     
BinGUID2,*,2,BI                     
BinGUID3,*,2,BI                     
BinGUID4,*,2,BI                     
BinGUID5,*,6,BI                     
//*                                 
//SYSIN    DD  *                   
 INREC OVERLAY=(SeqNum:SEQNUM,4,BI,START=01010101,                     
                                    INCR=01030507,                     
                DateTime5:&DATE5)                                       
 SORT FIELDS=COPY                                                       
 OUTREC IFTHEN=(WHEN=INIT,                                             
                OVERLAY=(Code1:NumsRight9,TO=BI,LENGTH=4,               
                         Code2:NumsLeft9,TO=BI,LENGTH=4,               
                         Code3:NumsRight9,TO=BI,LENGTH=4,               
                         Code4:NumsLeft9,TO=BI,LENGTH=4)),             
        IFTHEN=(WHEN=INIT,                                             
                OVERLAY=(Code1:Code1,SUB,SeqNum,TO=BI,LENGTH=4,         
                         Code2:Code2,SUB,SeqNum,TO=BI,LENGTH=4,         
                         Code3:Code3,ADD,SeqNum,TO=BI,LENGTH=4,         
                         Code4:Code4,ADD,SeqNum,TO=BI,LENGTH=4)),       
        IFTHEN=(WHEN=INIT,                                             
                OVERLAY=(GUID:BinGUID1,HEX,C'-',                       
                              BinGUID2,HEX,C'-',                       
                              BinGUID3,HEX,C'-',                       
                              BinGUID4,HEX,C'-',                       
                              BinGUID5,HEX))                           
 OUTFIL FNAMES=(SORTOUT,SORTOUTF),                                     
        BUILD=(SourceRec)                                               
 END                                                                   
//*                                                                     
//*=====================================================================


Code:
********************************* TOP OF DATA ******************************************
TRANSACTION 00               1411DB97-0E46-7720-1430-AF010E654A8A                       
TRANSACTION 01               1402222C-0E36-BDB5-1440-686C0E7503F5                       
TRANSACTION 02               13F268C1-0E27-044A-1450-21D70E84BD60                       
TRANSACTION 03               13E2AF56-0E17-4ADF-145F-DB420E9476CB                       
TRANSACTION 04               13D2F5EB-0E07-9174-146F-94AD0EA43036                       
TRANSACTION 05               13C33C80-0DF7-D809-147F-4E180EB3E9A1                       
TRANSACTION 06               13B38315-0DE8-1E9E-148F-07830EC3A30C                       
TRANSACTION 07               13A3C9AA-0DD8-6533-149E-C0EE0ED35C77                       
TRANSACTION 08               1394103F-0DC8-ABC8-14AE-7A590EE315E2                       
TRANSACTION 10               138456D4-0DB8-F25D-14BE-33C40EF2CF4D                       
******************************** BOTTOM OF DATA ****************************************
Back to top
View user's profile Send private message
pinakimishra

New User


Joined: 21 Jul 2007
Posts: 24
Location: phoenix

PostPosted: Sat May 11, 2024 10:46 pm
Reply with quote

Thanks for the suggestions.

COBOL Program works as mentioned in stackoverflow.com/questions/25703620/auto-generation-of-a-unique-id-using-cobol and suggested by Joerg.Findeisen

Will go with it as its out of the box.

@sergeyken - Appreicate your efforts of providing the sortcard. will go through it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts DFSORT - VB file RDW getting overridden DFSORT/ICETOOL 3
Search our Forums:

Back to Top