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/rexx job to replicate records in file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Saini19

New User


Joined: 12 Apr 2012
Posts: 23
Location: Singapore

PostPosted: Thu Nov 15, 2012 1:24 pm    Post subject: sort/rexx job to replicate records in file
Reply with quote

I have a file (VB 32191 length) with 6 records ... where each record actually spans in 2 lines ... now I want to replicate each record 500 times ... making total as 3000.

The problem is, there are two fields referring them as "A" and "B". "A" field occurs at static 191'th byte in both rows of a single record, as well as between tags <TAGONE> and </TAGONE> that can occur at any position ... I want that for all 500 records, this field (a 10byte numeric field) should have unique values or else my logic will abend ...

Also, the field "B" appears between tags <TAGTWO> and </TAGTWO>, again at varying positions 9 byte alphanumeric, which again has to be unique for all records ...

This needs something in REXX I believe to replicate the records but I am totally unaware of REXX ... can anybody help me here please.
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 785
Location: Chennai, India

PostPosted: Thu Nov 15, 2012 1:41 pm    Post subject:
Reply with quote

Please post sample input and output records, for clarification. Kindly use code tags.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Nov 15, 2012 1:43 pm    Post subject: Reply to: sort/rexx job to replicate records in file
Reply with quote

If you're considering SORT, look at your documentation for OUTFIL REPEAT.

You can use a SEQNUM to make A in fixed position unique.

You need to check on PARSE for limits to the size of a field, but basically break it up by PARSEing it, then put it back together with two "tagged" values, (the B can also be a SEQNUM).

If you want to go that way, tell us which SORT product you use so that the topic can be moved.

You do want 500 copies of record one, followed by 500 copies of record two, etc...?
Back to top
View user's profile Send private message
Saini19

New User


Joined: 12 Apr 2012
Posts: 23
Location: Singapore

PostPosted: Thu Nov 15, 2012 1:51 pm    Post subject:
Reply with quote

Gnanas N wrote:
Please post sample input and output records, for clarification. Kindly use code tags.


0000011100<TAGONE>111</TAGONE>DBABGBAMB<TAGTWO>ABC123</TAGTWO>EEEEEEEEEE
0000011100NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000002220000000<TAGONE>222</TAGONE>AFAFAFAF<TAGTWO>ABC123</TAGTWO>GGGGGG
0000022200MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
00000333<TAGONE>333</TAGONE>AFAFAFAFAAAAA<TAGTWO>ABC123</TAGTWO>GGGGGGGG
0000033300KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK


like in this example, "A" field is a static 5th byte of length 3-bytes and also between TAGONE at different positions in various records

"B" field is between TAGTWO at varying positions of 6 byte alphanumeric
Back to top
View user's profile Send private message
Saini19

New User


Joined: 12 Apr 2012
Posts: 23
Location: Singapore

PostPosted: Thu Nov 15, 2012 1:52 pm    Post subject:
Reply with quote

Code:
0000011100<TAGONE>111</TAGONE>DBABGBAMB<TAGTWO>ABC123</TAGTWO>EEEEEEEEEE
0000011100NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000002220000000<TAGONE>222</TAGONE>AFAFAFAF<TAGTWO>ABC123</TAGTWO>GGGGGG
0000022200MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
00000333<TAGONE>333</TAGONE>AFAFAFAFAAAAA<TAGTWO>ABC123</TAGTWO>GGGGGGGG
0000033300KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
Back to top
View user's profile Send private message
Saini19

New User


Joined: 12 Apr 2012
Posts: 23
Location: Singapore

PostPosted: Thu Nov 15, 2012 1:54 pm    Post subject: Re: Reply to: sort/rexx job to replicate records in file
Reply with quote

Bill Woodger wrote:
If you're considering SORT, look at your documentation for OUTFIL REPEAT.

You can use a SEQNUM to make A in fixed position unique.

You need to check on PARSE for limits to the size of a field, but basically break it up by PARSEing it, then put it back together with two "tagged" values, (the B can also be a SEQNUM).

If you want to go that way, tell us which SORT product you use so that the topic can be moved.

You do want 500 copies of record one, followed by 500 copies of record two, etc...?




for your first query, we have DFSORT

for your second query, it can be in any order

order will not matter, just the uniqueness of these two fields matter
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Nov 15, 2012 3:01 pm    Post subject: Reply to: sort/rexx job to replicate records in file
Reply with quote

OK, before moving it we need to know if it may fly.

I can't see a maximum for FIXLEN in PARSE, so how about you have an experiment to see.

With your records, try a simple PARSE with FIXLEN=32000

Let us know.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Thu Nov 15, 2012 3:39 pm    Post subject: Reply to: sort/rexx job to replicate records in file
Reply with quote

Quote:
This needs something in REXX I believe to replicate the records but I am totally unaware of REXX


just curious ...
if You are - as You say - totally unaware of REXX,
why in &heaven did You chose REXX for a solution ? icon_cool.gif
Back to top
View user's profile Send private message
Saini19

New User


Joined: 12 Apr 2012
Posts: 23
Location: Singapore

PostPosted: Thu Nov 15, 2012 4:20 pm    Post subject: Re: Reply to: sort/rexx job to replicate records in file
Reply with quote

enrico-sorichetti wrote:
Quote:
This needs something in REXX I believe to replicate the records but I am totally unaware of REXX


just curious ...
if You are - as You say - totally unaware of REXX,
why in &heaven did You chose REXX for a solution ? icon_cool.gif


I just made a guess since I have heard a lot about REXX from my colleagues that it can do any wonder icon_razz.gif naive user you know

Anyways, will keep you all posted with what I get, though working with REPEAT on varying position field seems tough to me ... icon_sad.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Thu Nov 15, 2012 5:50 pm    Post subject: Reply to: sort/rexx job to replicate records in file
Reply with quote

and ... apart the <language>/<utility> used
what are the rules to create unique A and B values ?
Back to top
View user's profile Send private message
Saini19

New User


Joined: 12 Apr 2012
Posts: 23
Location: Singapore

PostPosted: Thu Nov 15, 2012 6:06 pm    Post subject: Re: Reply to: sort/rexx job to replicate records in file
Reply with quote

enrico-sorichetti wrote:
and ... apart the <language>/<utility> used
what are the rules to create unique A and B values ?


No rules except that A is numeric in nature while B is alphanumeric.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Thu Nov 15, 2012 7:08 pm    Post subject: Reply to: sort/rexx job to replicate records in file
Reply with quote

Your description is inconsistent with the data you provided

since at the end You will have 1500 different couples of records
the requirement about equality of TAGONE filed with the data at 6,3 cannot be satisfied

here is a REXX snippet that will do it
( the whole first 8 bytes will be considered as the <key>


Code:
Trace "O"
signal on novalue name novalue
numeric digits 12

arbdgts  = "0A1B2C3D4E5F6G7H8I9JKLMNOPQRSTUVWXYZ"

in.0 = 6
in.1 = "0000011100<TAGONE>111</TAGONE>DBABGBAMB<TAGTWO>ABC123</TAGTWO>EEEEEEEEEE"
in.2 = "0000011100NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN"
in.3 = "000002220000000<TAGONE>222</TAGONE>AFAFAFAF<TAGTWO>ABC123</TAGTWO>FFFFFF"
in.4 = "0000022200MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"
in.5 = "0000033300<TAGONE>333</TAGONE>AFAFAFAFAAAAA<TAGTWO>ABC123</TAGTWO>GGGGGG"
in.6 = "0000033300KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK"

k1 = random(999)
k2 = random(10000,99999)
kd = random(1,999)

do 10
    do  i = 1 to in.0 by 2
        j = i+1
        ou.1 = substr(in.i,9)
        parse var ou.1 h1 "<TAGONE>" . "</TAGONE>" t1
        ou.1 = right(k1,8,"0") || h1 || "<TAGONE>" || k1 || "</TAGONE>" || t1
        parse var ou.1 h1 "<TAGTWO>" . "</TAGTWO>" t1
        ou.1 = h1 || "<TAGTWO>" || to_arb(k2) || "</TAGTWO>" || t1
        ou.2 = right(k1,8,"0") || substr(in.j,9)
        say ou.1
        say ou.2
    end
    k1 = k1 + kd
    k2 = k2 + kd
end
exit

logic_error:
call __log  "******************************************************************"
call __log  "** "
call __log  "** Logic error at line '"sigl"' "
call __log  "** "
call __log  "******************************************************************"
exit

novalue:
call __log  "******************************************************************"
call __log  "** "
call __log  "** Novalue trapped, line '"sigl"' var '"condition("D")"' "
call __log  "** "
call __log  "******************************************************************"
exit

to_dec:procedure expose arbdgts
   trace "O"
   parse upper arg arbn
   base  = length(arbdgts)
   mult  = 1
   decn  = 0
   do  d = length(arbn) to 1 by -1
      work = substr(arbn,d,1)
      decn = decn + mult * ( pos(work,arbdgts) - 1 )
      mult = mult * base
   end
   return decn

to_arb:procedure expose arbdgts
   trace "O"
   parse upper arg decn
   base = length(arbdgts)
   arbn = ""
   do while ( decn >= base )
      work = decn //  base
      decn = decn % base
      arbn = substr(arbdgts,work+1,1) || arbn
   end
   arbn = substr(arbdgts,decn+1,1) || arbn
   return arbn


and here is the result

Code:
0000038900<TAGONE>389</TAGONE>DBABGBAMB<TAGTWO>VE2</TAGTWO>EEEEEEEEEE
0000038900NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000003890000000<TAGONE>389</TAGONE>AFAFAFAF<TAGTWO>VE2</TAGTWO>FFFFFF
0000038900MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000038900<TAGONE>389</TAGONE>AFAFAFAFAAAAA<TAGTWO>VE2</TAGTWO>GGGGGG
0000038900KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000135800<TAGONE>1358</TAGONE>DBABGBAMB<TAGTWO>W0A</TAGTWO>EEEEEEEEEE
0000135800NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000013580000000<TAGONE>1358</TAGONE>AFAFAFAF<TAGTWO>W0A</TAGTWO>FFFFFF
0000135800MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000135800<TAGONE>1358</TAGONE>AFAFAFAFAAAAA<TAGTWO>W0A</TAGTWO>GGGGGG
0000135800KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000232700<TAGONE>2327</TAGONE>DBABGBAMB<TAGTWO>WQY</TAGTWO>EEEEEEEEEE
0000232700NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000023270000000<TAGONE>2327</TAGONE>AFAFAFAF<TAGTWO>WQY</TAGTWO>FFFFFF
0000232700MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000232700<TAGONE>2327</TAGONE>AFAFAFAFAAAAA<TAGTWO>WQY</TAGTWO>GGGGGG
0000232700KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000329600<TAGONE>3296</TAGONE>DBABGBAMB<TAGTWO>XIV</TAGTWO>EEEEEEEEEE
0000329600NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000032960000000<TAGONE>3296</TAGONE>AFAFAFAF<TAGTWO>XIV</TAGTWO>FFFFFF
0000329600MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000329600<TAGONE>3296</TAGONE>AFAFAFAFAAAAA<TAGTWO>XIV</TAGTWO>GGGGGG
0000329600KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000426500<TAGONE>4265</TAGONE>DBABGBAMB<TAGTWO>Y4S</TAGTWO>EEEEEEEEEE
0000426500NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000042650000000<TAGONE>4265</TAGONE>AFAFAFAF<TAGTWO>Y4S</TAGTWO>FFFFFF
0000426500MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000426500<TAGONE>4265</TAGONE>AFAFAFAFAAAAA<TAGTWO>Y4S</TAGTWO>GGGGGG
0000426500KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000523400<TAGONE>5234</TAGONE>DBABGBAMB<TAGTWO>YZP</TAGTWO>EEEEEEEEEE
0000523400NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000052340000000<TAGONE>5234</TAGONE>AFAFAFAF<TAGTWO>YZP</TAGTWO>FFFFFF
0000523400MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000523400<TAGONE>5234</TAGONE>AFAFAFAFAAAAA<TAGTWO>YZP</TAGTWO>GGGGGG
0000523400KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000620300<TAGONE>6203</TAGONE>DBABGBAMB<TAGTWO>ZQM</TAGTWO>EEEEEEEEEE
0000620300NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000062030000000<TAGONE>6203</TAGONE>AFAFAFAF<TAGTWO>ZQM</TAGTWO>FFFFFF
0000620300MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000620300<TAGONE>6203</TAGONE>AFAFAFAFAAAAA<TAGTWO>ZQM</TAGTWO>GGGGGG
0000620300KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000717200<TAGONE>7172</TAGONE>DBABGBAMB<TAGTWO>A0IJ</TAGTWO>EEEEEEEEEE
0000717200NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000071720000000<TAGONE>7172</TAGONE>AFAFAFAF<TAGTWO>A0IJ</TAGTWO>FFFFFF
0000717200MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000717200<TAGONE>7172</TAGONE>AFAFAFAFAAAAA<TAGTWO>A0IJ</TAGTWO>GGGGGG
0000717200KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000814100<TAGONE>8141</TAGONE>DBABGBAMB<TAGTWO>AA48</TAGTWO>EEEEEEEEEE
0000814100NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000081410000000<TAGONE>8141</TAGONE>AFAFAFAF<TAGTWO>AA48</TAGTWO>FFFFFF
0000814100MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000814100<TAGONE>8141</TAGONE>AFAFAFAFAAAAA<TAGTWO>AA48</TAGTWO>GGGGGG
0000814100KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000911000<TAGONE>9110</TAGONE>DBABGBAMB<TAGTWO>AAZG</TAGTWO>EEEEEEEEEE
0000911000NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000091100000000<TAGONE>9110</TAGONE>AFAFAFAF<TAGTWO>AAZG</TAGTWO>FFFFFF
0000911000MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000911000<TAGONE>9110</TAGONE>AFAFAFAFAAAAA<TAGTWO>AAZG</TAGTWO>GGGGGG
0000911000KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Thu Nov 15, 2012 7:15 pm    Post subject: Reply to: sort/rexx job to replicate records in file
Reply with quote

follow on ...
changing the k2 seed to
Code:
k2 = random(900000000,999999999)

will provide a longer TAGTWO field

resulting for example in
Code:

0000009000<TAGONE>90</TAGONE>DBABGBAMB<TAGTWO>HCO05R</TAGTWO>EEEEEEEEEE
0000009000NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000000900000000<TAGONE>90</TAGONE>AFAFAFAF<TAGTWO>HCO05R</TAGTWO>FFFFFF
0000009000MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000009000<TAGONE>90</TAGONE>AFAFAFAFAAAAA<TAGTWO>HCO05R</TAGTWO>GGGGGG
0000009000KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000027900<TAGONE>279</TAGONE>DBABGBAMB<TAGTWO>HCO080</TAGTWO>EEEEEEEEEE
0000027900NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000002790000000<TAGONE>279</TAGONE>AFAFAFAF<TAGTWO>HCO080</TAGTWO>FFFFFF
0000027900MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000027900<TAGONE>279</TAGONE>AFAFAFAFAAAAA<TAGTWO>HCO080</TAGTWO>GGGGGG
0000027900KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000046800<TAGONE>468</TAGONE>DBABGBAMB<TAGTWO>HCO0LE</TAGTWO>EEEEEEEEEE
0000046800NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000004680000000<TAGONE>468</TAGONE>AFAFAFAF<TAGTWO>HCO0LE</TAGTWO>FFFFFF
0000046800MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000046800<TAGONE>468</TAGONE>AFAFAFAFAAAAA<TAGTWO>HCO0LE</TAGTWO>GGGGGG
0000046800KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000065700<TAGONE>657</TAGONE>DBABGBAMB<TAGTWO>HCO0Q9</TAGTWO>EEEEEEEEEE
0000065700NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000006570000000<TAGONE>657</TAGONE>AFAFAFAF<TAGTWO>HCO0Q9</TAGTWO>FFFFFF
0000065700MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000065700<TAGONE>657</TAGONE>AFAFAFAFAAAAA<TAGTWO>HCO0Q9</TAGTWO>GGGGGG
0000065700KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000084600<TAGONE>846</TAGONE>DBABGBAMB<TAGTWO>HCO0VR</TAGTWO>EEEEEEEEEE
0000084600NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000008460000000<TAGONE>846</TAGONE>AFAFAFAF<TAGTWO>HCO0VR</TAGTWO>FFFFFF
0000084600MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000084600<TAGONE>846</TAGONE>AFAFAFAFAAAAA<TAGTWO>HCO0VR</TAGTWO>GGGGGG
0000084600KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000103500<TAGONE>1035</TAGONE>DBABGBAMB<TAGTWO>HCOAA0</TAGTWO>EEEEEEEEEE
0000103500NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000010350000000<TAGONE>1035</TAGONE>AFAFAFAF<TAGTWO>HCOAA0</TAGTWO>FFFFFF
0000103500MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000103500<TAGONE>1035</TAGONE>AFAFAFAFAAAAA<TAGTWO>HCOAA0</TAGTWO>GGGGGG
0000103500KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000122400<TAGONE>1224</TAGONE>DBABGBAMB<TAGTWO>HCOA3E</TAGTWO>EEEEEEEEEE
0000122400NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000012240000000<TAGONE>1224</TAGONE>AFAFAFAF<TAGTWO>HCOA3E</TAGTWO>FFFFFF
0000122400MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000122400<TAGONE>1224</TAGONE>AFAFAFAFAAAAA<TAGTWO>HCOA3E</TAGTWO>GGGGGG
0000122400KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000141300<TAGONE>1413</TAGONE>DBABGBAMB<TAGTWO>HCOAF9</TAGTWO>EEEEEEEEEE
0000141300NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000014130000000<TAGONE>1413</TAGONE>AFAFAFAF<TAGTWO>HCOAF9</TAGTWO>FFFFFF
0000141300MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000141300<TAGONE>1413</TAGONE>AFAFAFAFAAAAA<TAGTWO>HCOAF9</TAGTWO>GGGGGG
0000141300KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000160200<TAGONE>1602</TAGONE>DBABGBAMB<TAGTWO>HCOA8R</TAGTWO>EEEEEEEEEE
0000160200NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000016020000000<TAGONE>1602</TAGONE>AFAFAFAF<TAGTWO>HCOA8R</TAGTWO>FFFFFF
0000160200MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000160200<TAGONE>1602</TAGONE>AFAFAFAFAAAAA<TAGTWO>HCOA8R</TAGTWO>GGGGGG
0000160200KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
0000179100<TAGONE>1791</TAGONE>DBABGBAMB<TAGTWO>HCOAM0</TAGTWO>EEEEEEEEEE
0000179100NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
000017910000000<TAGONE>1791</TAGONE>AFAFAFAF<TAGTWO>HCOAM0</TAGTWO>FFFFFF
0000179100MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
0000179100<TAGONE>1791</TAGONE>AFAFAFAFAAAAA<TAGTWO>HCOAM0</TAGTWO>GGGGGG
0000179100KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK


for real execution You should change the
DO 10 to DO 1500
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 16, 2012 2:58 am    Post subject: Reply to: sort/rexx job to replicate records in file
Reply with quote

With the size of your records, I'm sure PARSE will not work, so it is good you have some Rexx now.

There is a simple solution, though it may not suit your requirement. You could use FINDREP to destroy the original TAGONE and TAGTWO and then insert them in the first variable position on the relevant record. This makes them "fixed" in position, so simple to insert sequence numbers. However, TAGONE and TAGTWO will no longer be in their original positions, although it presumably will not affect the processing...
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Nov 16, 2012 3:54 am    Post subject: Reply to: sort/rexx job to replicate records in file
Reply with quote

I hope that the TS will be able to understand it..
the code is pretty tight icon_cool.gif

icon_redface.gif
disregard the previous snippets ,
( cut and paste syndrome struck again )
I pasted the increment of the values in the wrong place - outer loop instead of inner loop
( giving duplicate values for the <keys> )

here is the fixed code
Code:

Trace "O"
signal on novalue name novalue
numeric digits 12

arbdgts  = "0A1B2C3D4E5F6G7H8I9JKLMNOPQRSTUVWXYZ"

in.0 = 6
in.1 = "0000011100<TAGONE>111</TAGONE>DBABGBAMB<TAGTWO>ABC123</TAGTWO>EEEEEEEEEE"
in.2 = "0000011100NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN"
in.3 = "000002220000000<TAGONE>222</TAGONE>AFAFAFAF<TAGTWO>ABC123</TAGTWO>FFFFFF"
in.4 = "0000022200MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"
in.5 = "0000033300<TAGONE>333</TAGONE>AFAFAFAFAAAAA<TAGTWO>ABC123</TAGTWO>GGGGGG"
in.6 = "0000033300KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK"

k1 = random(999)
k2 = random(900000000,999999999)
kd = random(1,999)

do 10
    do  i = 1 to in.0 by 2
        j = i+1
        ou.1 = substr(in.i,9)
        parse var ou.1 h1 "<TAGONE>" . "</TAGONE>" t1
        ou.1 = right(k1,8,"0") || h1 || "<TAGONE>" || k1 || "</TAGONE>" || t1
        parse var ou.1 h1 "<TAGTWO>" . "</TAGTWO>" t1
        ou.1 = h1 || "<TAGTWO>" || to_arb(k2) || "</TAGTWO>" || t1
        ou.2 = right(k1,8,"0") || substr(in.j,9)
        say ou.1
        say ou.2
        say ""
        k1 = k1 + kd
        k2 = k2 + kd
    end
end
exit

logic_error:
call __log  "******************************************************************"
call __log  "** "
call __log  "** Logic error at line '"sigl"' "
call __log  "** "
call __log  "******************************************************************"
exit

novalue:
call __log  "******************************************************************"
call __log  "** "
call __log  "** Novalue trapped, line '"sigl"' var '"condition("D")"' "
call __log  "** "
call __log  "******************************************************************"
exit

to_dec:procedure expose arbdgts
   trace "O"
   parse upper arg arbn
   base  = length(arbdgts)
   mult  = 1
   decn  = 0
   do  d = length(arbn) to 1 by -1
      work = substr(arbn,d,1)
      decn = decn + mult * ( pos(work,arbdgts) - 1 )
      mult = mult * base
   end
   return decn

to_arb:procedure expose arbdgts
   trace "O"
   parse upper arg decn
   base = length(arbdgts)
   arbn = ""
   do while ( decn >= base )
      work = decn //  base
      decn = decn % base
      arbn = substr(arbdgts,work+1,1) || arbn
   end
   arbn = substr(arbdgts,decn+1,1) || arbn
   return arbn


and the result
Code:

0000072900<TAGONE>729</TAGONE>DBABGBAMB<TAGTWO>HBA2LN</TAGTWO>EEEEEEEEEE
0000072900NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

000011860000000<TAGONE>1186</TAGONE>AFAFAFAF<TAGTWO>HBA2Y6</TAGTWO>FFFFFF
0000118600MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0000164300<TAGONE>1643</TAGONE>AFAFAFAFAAAAA<TAGTWO>HBACFA</TAGTWO>GGGGGG
0000164300KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

0000210000<TAGONE>2100</TAGONE>DBABGBAMB<TAGTWO>HBACNQ</TAGTWO>EEEEEEEEEE
0000210000NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

000025570000000<TAGONE>2557</TAGONE>AFAFAFAF<TAGTWO>HBA30H</TAGTWO>FFFFFF
0000255700MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0000301400<TAGONE>3014</TAGONE>AFAFAFAFAAAAA<TAGTWO>HBA3G2</TAGTWO>GGGGGG
0000301400KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

0000347100<TAGONE>3471</TAGONE>DBABGBAMB<TAGTWO>HBA3PT</TAGTWO>EEEEEEEEEE
0000347100NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

000039280000000<TAGONE>3928</TAGONE>AFAFAFAF<TAGTWO>HBAD19</TAGTWO>FFFFFF
0000392800MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0000438500<TAGONE>4385</TAGONE>AFAFAFAFAAAAA<TAGTWO>HBADHD</TAGTWO>GGGGGG
0000438500KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

0000484200<TAGONE>4842</TAGONE>DBABGBAMB<TAGTWO>HBADRW</TAGTWO>EEEEEEEEEE
0000484200NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

000052990000000<TAGONE>5299</TAGONE>AFAFAFAF<TAGTWO>HBA42L</TAGTWO>FFFFFF
0000529900MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0000575600<TAGONE>5756</TAGONE>AFAFAFAFAAAAA<TAGTWO>HBA4I5</TAGTWO>GGGGGG
0000575600KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

0000621300<TAGONE>6213</TAGONE>DBABGBAMB<TAGTWO>HBA4TZ</TAGTWO>EEEEEEEEEE
0000621300NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

000066700000000<TAGONE>6670</TAGONE>AFAFAFAF<TAGTWO>HBAE3O</TAGTWO>FFFFFF
0000667000MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0000712700<TAGONE>7127</TAGONE>AFAFAFAFAAAAA<TAGTWO>HBAEJG</TAGTWO>GGGGGG
0000712700KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

0000758400<TAGONE>7584</TAGONE>DBABGBAMB<TAGTWO>HBAEW1</TAGTWO>EEEEEEEEEE
0000758400NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

000080410000000<TAGONE>8041</TAGONE>AFAFAFAF<TAGTWO>HBA54R</TAGTWO>FFFFFF
0000804100MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0000849800<TAGONE>8498</TAGONE>AFAFAFAFAAAAA<TAGTWO>HBA5L8</TAGTWO>GGGGGG
0000849800KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

0000895500<TAGONE>8955</TAGONE>DBABGBAMB<TAGTWO>HBA5YC</TAGTWO>EEEEEEEEEE
0000895500NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

000094120000000<TAGONE>9412</TAGONE>AFAFAFAF<TAGTWO>HBAF5U</TAGTWO>FFFFFF
0000941200MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0000986900<TAGONE>9869</TAGONE>AFAFAFAFAAAAA<TAGTWO>HBAFNJ</TAGTWO>GGGGGG
0000986900KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

0001032600<TAGONE>10326</TAGONE>DBABGBAMB<TAGTWO>HBA604</TAGTWO>EEEEEEEEEE
0001032600NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

000107830000000<TAGONE>10783</TAGONE>AFAFAFAF<TAGTWO>HBA66X</TAGTWO>FFFFFF
0001078300MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0001124000<TAGONE>11240</TAGONE>AFAFAFAFAAAAA<TAGTWO>HBA6PM</TAGTWO>GGGGGG
0001124000KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

0001169700<TAGONE>11697</TAGONE>DBABGBAMB<TAGTWO>HBAG1F</TAGTWO>EEEEEEEEEE
0001169700NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

000121540000000<TAGONE>12154</TAGONE>AFAFAFAF<TAGTWO>HBAGH0</TAGTWO>FFFFFF
0001215400MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0001261100<TAGONE>12611</TAGONE>AFAFAFAFAAAAA<TAGTWO>HBAGRP</TAGTWO>GGGGGG
0001261100KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

0001306800<TAGONE>13068</TAGONE>DBABGBAMB<TAGTWO>HBA727</TAGTWO>EEEEEEEEEE
0001306800NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

000135250000000<TAGONE>13525</TAGONE>AFAFAFAF<TAGTWO>HBA7IB</TAGTWO>FFFFFF
0001352500MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0001398200<TAGONE>13982</TAGONE>AFAFAFAFAAAAA<TAGTWO>HBA7TS</TAGTWO>GGGGGG
0001398200KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

Back to top
View user's profile Send private message
Saini19

New User


Joined: 12 Apr 2012
Posts: 23
Location: Singapore

PostPosted: Fri Nov 16, 2012 9:23 am    Post subject: Re: Reply to: sort/rexx job to replicate records in file
Reply with quote

Thanks to Bill and Enrico, and everybody who gave me certain ideas. I will execute the code and keep you posted on output. icon_smile.gif
Back to top
View user's profile Send private message
Saini19

New User


Joined: 12 Apr 2012
Posts: 23
Location: Singapore

PostPosted: Sun Nov 18, 2012 4:16 pm    Post subject: Reply to: sort/rexx job to replicate records in file
Reply with quote

Well, thanks Enrico for the solution, however it is having two impacts.

First, you have used RIGHT function to change the bytes, which is forcing my first 5 bytes also to be "0". I wanted to retain the original data. I am able to figure out it's solution. So this issue exists no longer.

Second, the RANDOM function used is changing the length of my B field, which is having an impact. I am not able to resolve this issue. Can you please help here with a solution, that should make it more dynamic. In the sense that it should consume the same number of bytes as is present in the input record.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Nov 19, 2012 1:33 am    Post subject: Reply to: sort/rexx job to replicate records in file
Reply with quote

before complaining with stupidities You should learn to post properly
( reread the whole topic from the beginning )

did You care to read my previous comments about the poor description of the requirements

as I already said there is a mismatch between the data shown and the description in words of the requirement ...

You said to repeat 500 hundred times to get 1500 <couples> of records
where the TAGONE must be numeric unique and must match <some part> of the <prefix key>

You defined as the unique part 3 three bytes,
with that assumption You cannot have uniqueness for 1500 <things>

second You told that
TAGONE content would be numeric up to 9 digits
TAGTWO content would be alphanumeric up to 10 chars

Quote:
I want that for all 500 records, this field (a 10byte numeric field) should have unique values or else my logic will abend ...

Also, the field "B" appears between tags <TAGTWO> and </TAGTWO>, again at varying positions 9 byte alphanumeric, which again has to be unique for all records ...
now You change You mind ...



given the above assumption the snippet posted satisfied the requirement

with the natural assumption that non <tagged> fields should be considered as fixed length

repost clearly a logical description of the requirement
so that nobody will wast time replying to something that is not what You really want
icon_evil.gif

after that I will think if it is worth to spend my time to keep going on
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Nov 19, 2012 1:23 pm    Post subject: Re: Reply to: sort/rexx job to replicate records in file
Reply with quote

Before complaining with stupidities you should learn to post properly. Reread the whole topic from the beginning.

Such good words, I thought I'd use them again after your latest stupidity (was deleted).

If you are unable to take benefit from such good words, then I suggest you go to someone at your site for assistance. It is up to you how you go about that, but if you genuinely expect someone to help you, then learn how to take advice when seeking it, even if the advice is not what you want, or to ignore the advice with grace. The advice was well-intended and whether you know it or not was the advice you needed at that point.
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 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


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